Skip to content

Commit b4e30c9

Browse files
committed
bugfix, CAN deploy message
We should ignore the 100us continuity check the stratologger does when powering off. Also, panicing when there's an error sending the can deploy message is not a good idea, for now just log the error and keep going.
1 parent d21bfd0 commit b4e30c9

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

  • controlSystem/RecoveryBoard/firmware-rs/src/bin

controlSystem/RecoveryBoard/firmware-rs/src/bin/sender.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ async fn main(spawner: Spawner) {
146146
let can_txb = can_tx.buffered(CAN_TX_BUF.init(TxBuf::<CAN_BUF_SIZE>::new()));
147147
let can_rxb = can_rx.buffered(CAN_RX_BUF.init(RxBuf::<CAN_BUF_SIZE>::new()));
148148

149-
#[allow(unused_mut, unused_assignments)] // suppress warning when not compiling with disable_beep cfg
149+
#[allow(unused_mut, unused_assignments)]
150+
// suppress warning when not compiling with disable_beep cfg
150151
let mut buzz_mode = BuzzerMode::Low;
151152

152153
#[cfg(disable_beep)]
@@ -345,6 +346,13 @@ async fn handle_iso_rising_edge(mut iso: ExtiInput<'static, Async>, can_id: u16)
345346
loop {
346347
info!("awaiting signal from telemetrum");
347348
iso.wait_for_rising_edge().await;
349+
Timer::after_millis(10).await;
350+
if iso.is_low() {
351+
// Stratologger will pulse for 100us on startup to check continuity
352+
// We should ignore this
353+
continue;
354+
}
355+
348356
info!("telemetrum signalling to deploy: {}", can_id);
349357
let time_now = Instant::now().as_millis();
350358
if can_id == DROGUE_DEPLOY_ID {
@@ -357,11 +365,13 @@ async fn handle_iso_rising_edge(mut iso: ExtiInput<'static, Async>, can_id: u16)
357365
{
358366
let mut shore_power_on_unlocked = SHORE_POW_ON_MTX.lock().await;
359367
if let Some(spo_ref) = shore_power_on_unlocked.as_mut() {
360-
if spo_ref.is_high() {
361-
info!("sending deploy message");
362-
if send_deploy_msg(can_id).await.is_err() {
363-
panic!()
364-
}
368+
if spo_ref.is_low() {
369+
// Shore power is on when spo is low, so we shouldn't deploy
370+
continue;
371+
}
372+
info!("sending deploy message");
373+
if let Err(e) = send_deploy_msg(can_id).await {
374+
error!("Error sending deployment message: {}", e);
365375
}
366376
}
367377
}

0 commit comments

Comments
 (0)