From b7d9b37bb07a4275bfa049cf79d3477b02a9fb45 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Wed, 22 Apr 2026 11:41:33 -0600 Subject: [PATCH] =?UTF-8?q?feat:=20auto-resume=20RX=20across=20SET=5FCONFI?= =?UTF-8?q?G=20(protocol=20v1.1=20=C2=A73.5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/radio.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/radio.rs b/src/radio.rs index fac29a3..fc2eb45 100644 --- a/src/radio.rs +++ b/src/radio.rs @@ -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 {