feat: auto-resume RX across SET_CONFIG (protocol v1.1 §3.5)

Inside state Receiving, override the parent Configured state chart handler on(ConfigApplied) => Idle with on(ConfigApplied) => ResumingRx. ResumingRx entry (try_start_rx_hw) re-enables RX on the chip with the new modulation once apply_set_config has finished the SPI write + calibration, and transitions back to Receiving on StartRxOk.


Net effect: SET_CONFIG issued while the radio is in continuous RX no longer kicks the radio (and therefore the OLED) out to idle. The RX ring is still cleared by apply_set_config; callers never need to re-issue RX_START after SET_CONFIG.


This matches donglora-protocol 1.1.0 §3.5 and §6.3 normative behavior.
This commit is contained in:
swaits committed 2026-04-22 11:47:14 -06:00
1 parent b0ce0a7aca
commit b7d9b37bb0
1 file changed
+12 -4
+12 -4
View File
@@ -170,10 +170,11 @@ statechart! {
state Configured {
on(CmdSetConfig(m: Modulation)) => apply_set_config;
on(ConfigFailedRadio) => Unconfigured;
// Re-configure from any substate (Receiving, Transmitting, …)
// drops back to Idle. Spec §3.5: "Any continuous RX is
// stopped. RX ring is cleared." Only successful applies
// emit ConfigApplied, so validation failures keep state.
// Default post-reconfigure landing is Idle. The RX ring is
// always cleared as part of apply_set_config. Receiving
// overrides this handler to auto-resume RX with the new
// parameters (spec §3.5) so callers do not need to re-issue
// RX_START after SET_CONFIG.
on(ConfigApplied) => Idle;
default(Idle);
@@ -202,6 +203,13 @@ statechart! {
on(CmdRxStop) => stop_rx_hw, respond_ok;
on(CmdRxStop) => Idle;
on(CmdTx) => TransmittingFromRx;
// Spec §3.5: a SET_CONFIG issued while receiving clears
// the RX ring (already handled by apply_set_config) but
// auto-rearms RX with the new parameters — the caller
// does not need to send a fresh RX_START. Override the
// parent's `on(ConfigApplied) => Idle` by landing in
// ResumingRx, whose entry kicks the chip back into RX.
on(ConfigApplied) => ResumingRx;
}
state ResumingRx {