From b4fb42dba48338b22e1783df81212aea6ee52c3e Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Sat, 7 Mar 2026 10:17:39 +0100 Subject: [PATCH] [fix](trx-server): clear CW history on ResetCwDecoder ResetCwDecoder already bumped cw_decode_reset_seq but omitted the history flush that APRS, FT8, and WSPR all perform. Wire clear_cw_history() into the handler to match the pattern. Co-Authored-By: Claude Sonnet 4.6 Signed-off-by: Stan Grams --- src/trx-server/src/audio.rs | 4 ++++ src/trx-server/src/rig_task.rs | 1 + 2 files changed, 5 insertions(+) diff --git a/src/trx-server/src/audio.rs b/src/trx-server/src/audio.rs index 40520be..e375c5b 100644 --- a/src/trx-server/src/audio.rs +++ b/src/trx-server/src/audio.rs @@ -282,6 +282,10 @@ impl DecoderHistories { h.iter().map(|(_, evt)| evt.clone()).collect() } + pub fn clear_cw_history(&self) { + self.cw.lock().expect("cw history mutex poisoned").clear(); + } + // --- FT8 --- fn prune_ft8(history: &mut VecDeque<(Instant, Ft8Message)>) { diff --git a/src/trx-server/src/rig_task.rs b/src/trx-server/src/rig_task.rs index 8078713..0324b71 100644 --- a/src/trx-server/src/rig_task.rs +++ b/src/trx-server/src/rig_task.rs @@ -437,6 +437,7 @@ async fn process_command( return snapshot_from(ctx.state); } RigCommand::ResetCwDecoder => { + ctx.histories.clear_cw_history(); ctx.state.cw_decode_reset_seq += 1; let _ = ctx.state_tx.send(ctx.state.clone()); return snapshot_from(ctx.state);