diff --git a/examples/xbd-net/src/embassy/executor.rs b/examples/xbd-net/src/embassy/executor.rs index f0f093d..77b6c4f 100644 --- a/examples/xbd-net/src/embassy/executor.rs +++ b/examples/xbd-net/src/embassy/executor.rs @@ -32,7 +32,11 @@ impl Executor { pub fn run(&'static mut self, init: impl FnOnce(Spawner)) -> ! { init(self.executor.spawner()); + let throttle = 100; + crate::println!("@@ Executor::run(): throttle: {} ms", throttle); + loop { + crate::Xbd::msleep(throttle, false); unsafe { self.executor.poll() }; } } diff --git a/examples/xbd-net/src/embassy/mod.rs b/examples/xbd-net/src/embassy/mod.rs index e7c583d..a54a3f5 100644 --- a/examples/xbd-net/src/embassy/mod.rs +++ b/examples/xbd-net/src/embassy/mod.rs @@ -1,17 +1,11 @@ -use super::xbd::{self, Xbd}; +use super::xbd; mod executor; use executor::Executor; #[embassy_executor::task] -async fn task_xbd_main(throttle: u32) { +async fn task_xbd_main() { super::xbd_main().await.unwrap(); - - //loop { Xbd::async_sleep(1000).await; } // yield -> executor busy - //==== - //loop { Xbd::msleep(1000, true); } // not yield (debug for internal async API calls only) -> executor not busy - //==== kludge - loop { Xbd::async_sleep(1).await; Xbd::msleep(throttle, false); } // yield && less busy } #[embassy_executor::task] @@ -47,11 +41,8 @@ impl Runtime { } pub fn run(&'static mut self) -> ! { - let throttle = 200; - crate::println!("@@ task_xbd_main(): throttle: {} ms", throttle); - self.0.run(|spawner| { - spawner.spawn(task_xbd_main(throttle)).unwrap(); + spawner.spawn(task_xbd_main()).unwrap(); spawner.spawn(task_shell_stream()).unwrap(); spawner.spawn(task_gcoap_server_stream()).unwrap(); spawner.spawn(task_api_stream()).unwrap();