diff --git a/src/bin/main.rs b/src/bin/main.rs index 451c4f3..3724d8b 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -100,9 +100,9 @@ async fn main(spawner: Spawner) { { use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice; use esp_hal::{i2c::master::{Config, I2c}, Async}; - use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, mutex::Mutex}; + use embassy_sync::{blocking_mutex::raw::NoopRawMutex, mutex::Mutex}; - static I2C_BUS: StaticCell>> = StaticCell::new(); + static I2C_BUS: StaticCell>> = StaticCell::new(); info!("Launching i2c sensor tasks"); let sda = peripherals.GPIO4; diff --git a/src/tasks/gps.rs b/src/tasks/gps.rs index 99275ef..040e938 100644 --- a/src/tasks/gps.rs +++ b/src/tasks/gps.rs @@ -1,6 +1,6 @@ use alloc::string::String; use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice; -use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, channel::DynamicSender}; +use embassy_sync::{blocking_mutex::raw::NoopRawMutex, channel::DynamicSender}; use embassy_time::Timer; use embedded_hal_async::i2c::I2c as _; use esp_hal::{i2c::master::I2c, Async}; @@ -12,7 +12,7 @@ use crate::{backoff::Backoff, events::{Measurement, SensorSource, SensorState}}; // FIXME: We need a way to put the GPS to sleep when the system goes to sleep #[embassy_executor::task] -pub async fn gps_task(events: DynamicSender<'static, Measurement>, mut i2c_bus: I2cDevice<'static, CriticalSectionRawMutex, I2c<'static, Async>>) { +pub async fn gps_task(events: DynamicSender<'static, Measurement>, mut i2c_bus: I2cDevice<'static, NoopRawMutex, I2c<'static, Async>>) { Backoff::from_secs(5).forever().attempt::<_, (), ()>(async || { events.send(Measurement::SensorHardwareStatus(SensorSource::GPS, SensorState::Offline)).await; Backoff::from_secs(5).forever().attempt(async || { @@ -41,7 +41,6 @@ pub async fn gps_task(events: DynamicSender<'static, Measurement>, mut i2c_bus: let mut parsing = false; let mut has_lock = false; events.send(Measurement::SensorHardwareStatus(SensorSource::GPS, SensorState::Online)).await; - events.send(Measurement::SensorHardwareStatus(SensorSource::Location, SensorState::AcquiringFix)).await; info!("GPS is ready!"); loop { let mut buf = [0; 1]; diff --git a/src/tasks/mpu.rs b/src/tasks/mpu.rs index 842c1da..b483a9f 100644 --- a/src/tasks/mpu.rs +++ b/src/tasks/mpu.rs @@ -1,7 +1,8 @@ use core::cell::RefCell; use embassy_embedded_hal::shared_bus::asynch::i2c::I2cDevice; -use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, channel::DynamicSender}; +use embassy_sync::blocking_mutex::raw::NoopRawMutex; +use embassy_sync::channel::DynamicSender; use embassy_time::{Delay, Timer, Instant}; use esp_hal::{i2c::master::I2c, Async}; use log::*; @@ -33,7 +34,7 @@ fn gyro_raw_to_rads(raw: i16) -> f32 { static mut MPU_WAS_CALIBRATED: u8 = 0; #[embassy_executor::task] -pub async fn mpu_task(events: DynamicSender<'static, Measurement>, bus: I2cDevice<'static, CriticalSectionRawMutex, I2c<'static, Async>>) { +pub async fn mpu_task(events: DynamicSender<'static, Measurement>, bus: I2cDevice<'static, NoopRawMutex, I2c<'static, Async>>) { let backoff = Backoff::from_millis(5); let busref = RefCell::new(Some(bus)); @@ -111,7 +112,7 @@ pub async fn mpu_task(events: DynamicSender<'static, Measurement>, bus: I2cDevic }).await.ok(); } -async fn mpu_init(sensor: &mut Mpu6050>>) -> Result<(), Error>>> { +async fn mpu_init(sensor: &mut Mpu6050>>) -> Result<(), Error>>> { if cfg!(feature="wokwi") { warn!("Initializing simulated MPU"); Ok(())