// #![cfg_attr(not(feature = "simulator"), no_main)] use alloc::boxed::Box; #[cfg(feature = "limit-fps")] use crate::FRAME_DURATION_MIN; use crate::{ SIGNAL_LCD_SUBMIT, SIGNAL_UI_RENDER, ui::backend::SlintBackend, }; pub mod backend; pub mod window_adapter; slint::include_modules!(); #[embassy_executor::task] pub async fn run_renderer_task(backend: SlintBackend) { slint::platform::set_platform(Box::new(backend)).expect("backend already initialized"); let main = AppWindow::new().unwrap(); // Instead of having a `loop` in the non-async `SlintBackend::run_event_loop`, we achieve // async by having only one iteration of the loop run, and `await`ing here. // The following block is analogous to `main.run()`. { main.show().unwrap(); loop { slint::run_event_loop().unwrap(); SIGNAL_LCD_SUBMIT.signal(()); #[cfg(feature = "limit-fps")] embassy_time::Timer::after(FRAME_DURATION_MIN).await; SIGNAL_UI_RENDER.wait().await; } #[expect(unreachable_code)] main.hide().unwrap(); } }