fixup! refactor: create mqtt module with core MQTT statics and tasks

fix: add missing crate::bail import and move mk_static! macro before usage
This commit is contained in:
2026-05-05 22:22:29 +02:00
parent a84a325852
commit f70ce6a108

View File

@@ -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>,