From dbab19e10f4341621f915e344d438424d030ec7a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 17 Mar 2026 15:33:36 +0100 Subject: [PATCH] timeout corrections --- satrs-example/src/acs/mgm.rs | 8 +++++--- satrs-example/src/config.rs | 2 +- satrs-example/src/main.rs | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/satrs-example/src/acs/mgm.rs b/satrs-example/src/acs/mgm.rs index 706d41a..e65923f 100644 --- a/satrs-example/src/acs/mgm.rs +++ b/satrs-example/src/acs/mgm.rs @@ -169,6 +169,7 @@ impl MgmHandlerLis3Mdl { spi_com: SpiCommunication, shared_mgm_set: Arc>, mode_leaf_helper: ModeLeafHelper, + mode_timeout: Duration ) -> Self { Self { id, @@ -176,7 +177,7 @@ impl MgmHandlerLis3Mdl { switch_helper, spi_com, shared_mgm_set, - mode_helpers: ModeHelper::new(DeviceMode::Off, Duration::from_millis(200)), + mode_helpers: ModeHelper::new(DeviceMode::Off, mode_timeout), buffers: BufWrapper::default(), stamp_helper: TimestampHelper::default(), hk_helper: HkHelperSingleSet::new(false, Duration::from_millis(200)), @@ -392,6 +393,7 @@ impl MgmHandlerLis3Mdl { } if self.mode_helpers.transition_state == TransitionState::PowerSwitching { if self.switch_helper.is_switch_on(self.switch_id()) { + log::info!("switch is on"); self.mode_helpers.transition_state = TransitionState::Done; } else if self.mode_helpers.timed_out() { self.handle_mode_transition_failure(); @@ -420,13 +422,13 @@ impl MgmHandlerLis3Mdl { // Should be called to complete a mode transition successfully. fn handle_mode_reached(&mut self) { + let tc_commander = self.mode_helpers.finish(true); self.announce_mode(); - if let Some(requestor) = self.mode_helpers.tc_commander { + if let Some(requestor) = tc_commander { self.send_mode_tm(requestor); } // Inform our parent about mode changes. self.report_mode_to_parent(); - self.mode_helpers.finish(true); } fn announce_mode(&self) { diff --git a/satrs-example/src/config.rs b/satrs-example/src/config.rs index fb7f75b..1cf90bd 100644 --- a/satrs-example/src/config.rs +++ b/satrs-example/src/config.rs @@ -169,7 +169,7 @@ pub mod pool { pub mod tasks { pub const FREQ_MS_UDP_TMTC: u64 = 200; - pub const FREQ_MS_AOCS: u64 = 500; + pub const FREQ_MS_AOCS: u64 = 200; pub const FREQ_MS_CONTROLLER: u64 = 200; pub const SIM_CLIENT_IDLE_DELAY_MS: u64 = 5; } diff --git a/satrs-example/src/main.rs b/satrs-example/src/main.rs index 572aefb..922f8ba 100644 --- a/satrs-example/src/main.rs +++ b/satrs-example/src/main.rs @@ -188,6 +188,7 @@ fn main() { request_rx: mgm_0_mode_request_rx, report_tx: mgm_0_mode_report_tx, }, + Duration::from_millis(1000) ); let mut mgm_1_handler = mgm::MgmHandlerLis3Mdl::new( mgm::MgmId::_1, @@ -202,6 +203,7 @@ fn main() { request_rx: mgm_1_mode_request_rx, report_tx: mgm_1_mode_report_tx, }, + Duration::from_millis(1000) ); let mut mgm_assembly = mgm_assembly::Assembly::new( mgm_assembly::ParentQueueHelper { @@ -216,7 +218,7 @@ fn main() { tc_rx: mgm_assembly_tc_rx, tm_tx: tm_sink_tx.clone(), }, - Duration::from_millis(300), + Duration::from_millis(2000), ); let pcdu_serial_interface = if let Some(sim_client) = opt_sim_client.as_mut() {