sending messages to the tui chat

This commit is contained in:
Priec
2026-01-18 23:16:06 +01:00
parent ba2b3b188a
commit b729d3f23d
3 changed files with 10 additions and 16 deletions

View File

@@ -136,8 +136,8 @@ async fn main(spawner: Spawner) -> ! {
spawner.spawn(mpu::task::mpu_task(mpu_i2c)).expect("spawn mpu_task");
display::api::set_status("Booting...").await;
mqtt_subscribe("esp32/topic").await;
mqtt_publish("esp32/topic", b"online", QualityOfService::QoS1, false).await;
mqtt_subscribe("esp32/imu").await;
mqtt_publish("esp32/imu", b"online", QualityOfService::QoS1, false).await;
display::api::set_status("Running").await;
display::api::set_mqtt_status(true, 0).await;
@@ -171,8 +171,7 @@ async fn main(spawner: Spawner) -> ! {
}
imu_reading_count += 1;
// CRITICAL FIX: show_imu is now non-blocking (uses try_send internally)
// This prevents display channel backpressure from blocking the main loop
// Show_imu is now non-blocking (uses try_send internally)
display::api::show_imu(reading);
if imu_reading_count % MQTT_PUBLISH_DIVIDER == 0 {
@@ -228,7 +227,6 @@ async fn core1_network_task(
// Signal core 0 that network is ready
NETWORK_READY.signal(());
// Start MQTT on this core (it needs the stack)
spawner.spawn(mqtt_task(stack)).ok();
}
@@ -237,7 +235,7 @@ async fn handle_mqtt_message(msg: IncomingMsg) {
match txt {
"clear" => { display::api::clear().await; }
"status" => { mqtt_publish("esp32/status", b"running", QualityOfService::QoS1, false).await; }
_ => {}
_ => { display::api::add_chat_message(txt).await; }
}
}
}