From 3f87e22585c7f713aa411a31a1a5472325a078a1 Mon Sep 17 00:00:00 2001 From: Victoria Fischer Date: Wed, 11 Mar 2026 14:37:16 +0100 Subject: [PATCH] cargo: replace the 'motion' features with an i2c on/off flag, add a flag to switch between the mpu6050 and the next iteration board with the LSM6DS chip --- src/bin/main.rs | 8 +++----- src/tasks/mod.rs | 3 +-- src/tasks/ui.rs | 3 --- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/bin/main.rs b/src/bin/main.rs index fea3d9a..7dc87b9 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -114,7 +114,7 @@ async fn main(spawner: Spawner) { let mut io = esp_hal::gpio::Io::new(peripherals.IO_MUX); io.set_interrupt_handler(gpio_interrupt_handler); - #[cfg(feature="motion")] + #[cfg(feature="i2c")] { use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice; use esp_hal::{i2c::master::{Config, I2c}, Async}; @@ -127,12 +127,10 @@ async fn main(spawner: Spawner) { let scl = peripherals.GPIO3; let i2c = I2c::new(peripherals.I2C1, Config::default()).unwrap().with_scl(scl).with_sda(sda).into_async(); let i2c_bus = I2C_BUS.init(Mutex::new(i2c)); - #[cfg(feature="mpu")] + #[cfg(feature="mpu6050")] spawner.must_spawn(renderbug_bike::tasks::mpu::mpu_task(motion_bus.dyn_sender(), I2cDevice::new(i2c_bus), imu_interrupt)); - #[cfg(feature="gps")] + spawner.must_spawn(renderbug_bike::tasks::gps::gps_task(motion_bus.dyn_sender(), I2cDevice::new(i2c_bus))); - - // TODO: Everything i2c should be turned on by default, I guess. we don't need features for individual sensors, but we can keep the option to disable the whole bus for testing purposes spawner.must_spawn(renderbug_bike::tasks::usb_power::usb_task(I2cDevice::new(i2c_bus), pd_interrupt)); } diff --git a/src/tasks/mod.rs b/src/tasks/mod.rs index 96a2879..47d82c9 100644 --- a/src/tasks/mod.rs +++ b/src/tasks/mod.rs @@ -1,6 +1,5 @@ -#[cfg(feature="mpu")] +#[cfg(feature="mpu6050")] pub mod mpu; -#[cfg(feature="gps")] pub mod gps; #[cfg(feature="radio")] pub mod wifi; diff --git a/src/tasks/ui.rs b/src/tasks/ui.rs index 9807a1f..05af8b6 100644 --- a/src/tasks/ui.rs +++ b/src/tasks/ui.rs @@ -187,9 +187,6 @@ impl>; -#[cfg(feature="real-output")] pub type UiSurfacePool = BufferedSurfacePool>; #[embassy_executor::task]