diff --git a/boards/kakute-f7-mini-v3/src/main.rs b/boards/kakute-f7-mini-v3/src/main.rs index 78b071c..33a9daf 100644 --- a/boards/kakute-f7-mini-v3/src/main.rs +++ b/boards/kakute-f7-mini-v3/src/main.rs @@ -177,16 +177,10 @@ mod app { async fn imu_worker(context: imu_worker::Context) { let events = IMU_EVENTS.swap(0, Ordering::AcqRel); if events & IMU_EVENT_TRANSFER_FAULT != 0 { - if !matches!( - context - .local - .imu - .on_transfer_complete(SpiCompletion::TransferFault), - ImuEvent::Fault(_) - ) { - panic!("SPI fault without an active MPU transaction"); - } - panic!("SPI DMA transfer fault"); + let _ = context + .local + .imu + .on_transfer_complete(SpiCompletion::TransferFault); } if events & IMU_EVENT_TRANSFER_COMPLETE != 0 { match context @@ -198,24 +192,19 @@ mod app { SAMPLES.publish(sample); schedule_telemetry(TELEMETRY_EVENT_SAMPLE); } - ImuEvent::Fault(_) => panic!("MPU transfer failed"), - ImuEvent::Initialized | ImuEvent::Idle => {} + ImuEvent::Fault(_) | ImuEvent::Initialized | ImuEvent::Idle => {} } } - if events & IMU_EVENT_TIMER != 0 - && matches!(context.local.imu.on_periodic_tick(), ImuEvent::Fault(_)) - { - panic!("MPU initialization failed"); + if events & IMU_EVENT_TIMER != 0 { + let _ = context.local.imu.on_periodic_tick(); } - if events & IMU_EVENT_DRDY != 0 - && matches!(context.local.imu.on_data_ready(), ImuEvent::Fault(_)) - { - panic!("MPU sample submission failed"); + if events & IMU_EVENT_DRDY != 0 { + let _ = context.local.imu.on_data_ready(); } IMU_QUEUED.store(false, Ordering::Release); if IMU_EVENTS.load(Ordering::Acquire) != 0 && !IMU_QUEUED.swap(true, Ordering::AcqRel) { if imu_worker::spawn().is_err() { - panic!("IMU worker reschedule failed"); + IMU_QUEUED.store(false, Ordering::Release); } } } @@ -229,24 +218,20 @@ mod app { 2 => TxCompletion::TransferFault, _ => TxCompletion::NotPending, }; - if context.local.telemetry.on_dma_complete(completion).is_err() { - panic!("telemetry DMA failed"); - } + context.local.telemetry.on_dma_complete(completion); } if events & TELEMETRY_EVENT_SAMPLE != 0 { if let Some(sample) = SAMPLES.take_newer(context.local.observed_sample) { - if context.local.telemetry.publish_sample(&sample).is_err() { - panic!("RAW_IMU publication failed"); - } + // Telemetry never blocks flight work. A later sample or + // heartbeat gives the bounded queue another chance to send. + let _ = context.local.telemetry.publish_sample(&sample); } } if events & TELEMETRY_EVENT_HEARTBEAT != 0 { *context.local.heartbeat_divider = context.local.heartbeat_divider.wrapping_add(1); if *context.local.heartbeat_divider == 10 { *context.local.heartbeat_divider = 0; - if context.local.telemetry.publish_heartbeat().is_err() { - panic!("heartbeat publication failed"); - } + let _ = context.local.telemetry.publish_heartbeat(); context.local.led.toggle(); } } @@ -255,7 +240,7 @@ mod app { && !TELEMETRY_QUEUED.swap(true, Ordering::AcqRel) { if telemetry_worker::spawn().is_err() { - panic!("telemetry worker reschedule failed"); + TELEMETRY_QUEUED.store(false, Ordering::Release); } } } @@ -263,14 +248,14 @@ mod app { fn schedule_imu(event: u8) { IMU_EVENTS.fetch_or(event, Ordering::Release); if !IMU_QUEUED.swap(true, Ordering::AcqRel) && imu_worker::spawn().is_err() { - panic!("IMU worker schedule failed"); + IMU_QUEUED.store(false, Ordering::Release); } } fn schedule_telemetry(event: u8) { TELEMETRY_EVENTS.fetch_or(event, Ordering::Release); if !TELEMETRY_QUEUED.swap(true, Ordering::AcqRel) && telemetry_worker::spawn().is_err() { - panic!("telemetry worker schedule failed"); + TELEMETRY_QUEUED.store(false, Ordering::Release); } }