Skip to content

Commit 25eb787

Browse files
lexfreiclaude
andcommitted
fix(radio): update radio_conf.rx_when_idle in set_link_mode
OpenThread doesn't call otPlatRadioSetRxOnWhenIdle callback, so the radio config was never updated when link mode changed. This caused the ESP radio driver to keep rx_when_idle: false even when the device should stay awake to receive unsolicited messages. Now set_link_mode directly updates radio_conf.rx_when_idle to match the requested link mode, ensuring the ESP radio driver configuration stays in sync. Co-Authored-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent f5b7211 commit 25eb787

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

openthread/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,18 @@ impl<'a> OpenThread<'a> {
443443
let mut ot = self.activate();
444444
let state = ot.state();
445445

446+
// Update radio config rx_when_idle to match link mode.
447+
// OpenThread doesn't call otPlatRadioSetRxOnWhenIdle, so we must
448+
// update the radio config directly here to ensure the ESP radio
449+
// driver keeps the radio awake when needed.
450+
if state.ot.radio_conf.rx_when_idle != rx_on_when_idle {
451+
info!(
452+
"Updating radio config rx_when_idle: {} -> {}",
453+
state.ot.radio_conf.rx_when_idle, rx_on_when_idle
454+
);
455+
state.ot.radio_conf.rx_when_idle = rx_on_when_idle;
456+
}
457+
446458
let mode = otLinkModeConfig {
447459
_bitfield_align_1: [],
448460
_bitfield_1: otLinkModeConfig::new_bitfield_1(

0 commit comments

Comments
 (0)