nonsense, nothing is fixed
This commit is contained in:
@@ -150,14 +150,23 @@ async fn main(spawner: Spawner) -> ! {
|
||||
match select3(
|
||||
mqtt_rx.receive(),
|
||||
imu_rx.receive(),
|
||||
Timer::after(Duration::from_secs(30)),
|
||||
Timer::after(Duration::from_secs(5)),
|
||||
).await {
|
||||
Either3::First(msg) => {
|
||||
mqtt_msg_count += 1;
|
||||
handle_mqtt_message(msg).await;
|
||||
display::api::set_mqtt_status(true, mqtt_msg_count).await;
|
||||
}
|
||||
Either3::Second(reading) => {
|
||||
Either3::Second(mut reading) => {
|
||||
// Drain any queued IMU messages and keep only the latest
|
||||
let mut drained = 0;
|
||||
while let Ok(next) = imu_rx.try_receive() {
|
||||
reading = next;
|
||||
drained += 1;
|
||||
}
|
||||
if drained > 0 {
|
||||
log::info!("IMU drained {} stale readings before display", drained);
|
||||
}
|
||||
imu_reading_count += 1;
|
||||
display::api::show_imu(reading).await;
|
||||
if imu_reading_count % MQTT_PUBLISH_DIVIDER == 0 {
|
||||
@@ -169,7 +178,9 @@ async fn main(spawner: Spawner) -> ! {
|
||||
}
|
||||
}
|
||||
Either3::Third(_) => {
|
||||
info!("Heartbeat: {} IMU readings", imu_reading_count);
|
||||
crate::mpu::api::IMU_CHANNEL.clear();
|
||||
info!("IMU heartbeat: force-cleared queue, {} readings total", imu_reading_count);
|
||||
// info!("Heartbeat: {} IMU readings", imu_reading_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,7 +270,6 @@ async fn net_task(mut runner: Runner<'static, WifiDevice<'static>>) {
|
||||
|
||||
#[embassy_executor::task]
|
||||
async fn button_detection_task(mut select_btn: Input<'static>, mut next_btn: Input<'static>) {
|
||||
use embassy_futures::select::Either;
|
||||
loop {
|
||||
match select(
|
||||
select_btn.wait_for_rising_edge(),
|
||||
|
||||
Reference in New Issue
Block a user