From bfff095cf0640849b23cc03bdeff4f75185b83ba Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Wed, 4 Mar 2026 23:17:44 +0100 Subject: [PATCH] [fix](trx-core): auto-enable CW decode on CW/CWR mode When mode is set to CW/CWR, force cw_decode_enabled=true in state application to avoid stale disabled decode state. Also route initial mode setup through apply_mode. Co-authored-by: Codex Signed-off-by: Stan Grams --- src/trx-core/src/rig/state.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/trx-core/src/rig/state.rs b/src/trx-core/src/rig/state.rs index c14fa7b..b3141ef 100644 --- a/src/trx-core/src/rig/state.rs +++ b/src/trx-core/src/rig/state.rs @@ -166,7 +166,7 @@ impl RigState { state.status.freq = Freq { hz: initial_freq_hz, }; - state.status.mode = initial_mode; + state.apply_mode(initial_mode); state } @@ -250,7 +250,11 @@ impl RigState { /// Apply a mode change into the state. pub fn apply_mode(&mut self, mode: RigMode) { + let cw_mode = matches!(mode, RigMode::CW | RigMode::CWR); self.status.mode = mode; + if cw_mode { + self.cw_decode_enabled = true; + } } /// Apply a PTT change, resetting meters on TX off.