diff --git a/Cargo.toml b/Cargo.toml index 41e248a2..82983a15 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,7 +64,7 @@ mipidsi = "0.5" ssd1306 = "0.7" epd-waveshare = "0.5.0" async-io = "2" -async-executor = "1" +edge-executor = "0.4" futures-lite = "1" [build-dependencies] diff --git a/src/main.rs b/src/main.rs index da6e5813..1647b979 100644 --- a/src/main.rs +++ b/src/main.rs @@ -596,22 +596,24 @@ fn test_timer( thread::sleep(Duration::from_secs(3)); info!("About to schedule a periodic timer every five seconds"); - let periodic_timer = EspTaskTimerService::new()?.timer(move || { - info!("Tick from periodic timer"); - - let now = EspSystemTime {}.now(); - - eventloop.post(&EventLoopMessage::new(now), None).unwrap(); - - client - .publish( - "rust-esp32-std-demo", - QoS::AtMostOnce, - false, - format!("Now is {now:?}").as_bytes(), - ) - .unwrap(); - })?; + let periodic_timer = unsafe { + EspTaskTimerService::new()?.timer_nonstatic(move || { + info!("Tick from periodic timer"); + + let now = EspSystemTime {}.now(); + + eventloop.post(&EventLoopMessage::new(now), None).unwrap(); + + client + .publish( + "rust-esp32-std-demo", + QoS::AtMostOnce, + false, + format!("Now is {now:?}").as_bytes(), + ) + .unwrap(); + })? + }; periodic_timer.every(Duration::from_secs(5))?; @@ -718,7 +720,7 @@ fn test_mqtt_client() -> Result anyhow::Result<()> { use std::pin::pin; - use async_executor::LocalExecutor; + use edge_executor::LocalExecutor; async fn test_tcp_bind(executor: &LocalExecutor<'_>) -> std::io::Result<()> { /// Echoes messages from the client back to it.