[fix](trx-core): log invalid state machine transitions

Add debug-level tracing for rejected state transitions instead of
silently returning false, aiding debugging of unexpected rig behavior.

https://claude.ai/code/session_01XzurkeuUmamBuhQwxVy7T4
Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
Claude
2026-03-25 22:43:10 +00:00
committed by Stan Grams
parent 9cf66fc04a
commit edf16b63d6
+6 -1
View File
@@ -11,6 +11,7 @@ use std::fmt;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use serde::Serialize; use serde::Serialize;
use tracing::debug;
use crate::radio::freq::Freq; use crate::radio::freq::Freq;
use crate::rig::state::RigMode; use crate::rig::state::RigMode;
@@ -267,13 +268,17 @@ impl RigStateMachine {
/// Process an event and potentially transition to a new state. /// Process an event and potentially transition to a new state.
/// Returns true if a transition occurred. /// Returns true if a transition occurred.
pub fn process_event(&mut self, event: RigEvent) -> bool { pub fn process_event(&mut self, event: RigEvent) -> bool {
let new_state = self.next_state(event); let new_state = self.next_state(event.clone());
if let Some(state) = new_state { if let Some(state) = new_state {
self.state = state; self.state = state;
self.transition_count += 1; self.transition_count += 1;
self.last_transition = Some(Instant::now()); self.last_transition = Some(Instant::now());
true true
} else { } else {
debug!(
"Invalid state transition: {:?} + {:?} (ignored)",
self.state, event
);
false false
} }
} }