[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 <codex@openai.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -166,7 +166,7 @@ impl RigState {
|
|||||||
state.status.freq = Freq {
|
state.status.freq = Freq {
|
||||||
hz: initial_freq_hz,
|
hz: initial_freq_hz,
|
||||||
};
|
};
|
||||||
state.status.mode = initial_mode;
|
state.apply_mode(initial_mode);
|
||||||
state
|
state
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +250,11 @@ impl RigState {
|
|||||||
|
|
||||||
/// Apply a mode change into the state.
|
/// Apply a mode change into the state.
|
||||||
pub fn apply_mode(&mut self, mode: RigMode) {
|
pub fn apply_mode(&mut self, mode: RigMode) {
|
||||||
|
let cw_mode = matches!(mode, RigMode::CW | RigMode::CWR);
|
||||||
self.status.mode = mode;
|
self.status.mode = mode;
|
||||||
|
if cw_mode {
|
||||||
|
self.cw_decode_enabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Apply a PTT change, resetting meters on TX off.
|
/// Apply a PTT change, resetting meters on TX off.
|
||||||
|
|||||||
Reference in New Issue
Block a user