From f70ce6a108cfe7612e9844cea359d156930c97c4 Mon Sep 17 00:00:00 2001 From: ju6ge Date: Tue, 5 May 2026 22:22:29 +0200 Subject: [PATCH] fixup! refactor: create mqtt module with core MQTT statics and tasks fix: add missing crate::bail import and move mk_static! macro before usage --- rust/src/mqtt.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/rust/src/mqtt.rs b/rust/src/mqtt.rs index 2731c93..631827b 100644 --- a/rust/src/mqtt.rs +++ b/rust/src/mqtt.rs @@ -1,3 +1,4 @@ +use crate::bail; use crate::config::NetworkConfig; use crate::fat_error::{ContextExt, FatError, FatResult}; use crate::hal::PlantHal; @@ -135,6 +136,15 @@ async fn publish_inner(subtopic: &str, message: &str) -> FatResult<()> { } } +macro_rules! mk_static { + ($t:ty,$val:expr) => {{ + static STATIC_CELL: static_cell::StaticCell<$t> = static_cell::StaticCell::new(); + #[deny(unused_attributes)] + let x = STATIC_CELL.uninit().write(($val)); + x + }}; +} + pub async fn mqtt_init( network_config: &'static NetworkConfig, stack: Stack<'static>, @@ -239,15 +249,6 @@ pub async fn mqtt_init( Ok(()) } -macro_rules! mk_static { - ($t:ty,$val:expr) => {{ - static STATIC_CELL: static_cell::StaticCell<$t> = static_cell::StaticCell::new(); - #[deny(unused_attributes)] - let x = STATIC_CELL.uninit().write(($val)); - x - }}; -} - #[embassy_executor::task] async fn mqtt_runner( task: McutieTask<'static, String, PublishDisplay<'static, String, &'static str>, 2>,