mirror of
https://github.com/espressif/openthread.git
synced 2026-08-17 07:59:51 +00:00
[diag] set rx_when_idle mode when diag start/stop (#11035)
This commit fixes an issue related to #9554 where a new radio capability is introduced: RX_ON_WHEN_IDLE. In this commit, we set `rx_on_when_idle` to be true when calling `diag start`, and false when calling `diag stop` for devices which support `rx_on_when_idle`. This fix ensures that packets can still be received if `diag` is used after `ifconfig down`.
This commit is contained in:
@@ -495,6 +495,7 @@ Error Diags::ProcessStart(uint8_t aArgsLength, char *aArgs[])
|
||||
|
||||
IgnoreError(Get<Radio>().Enable());
|
||||
Get<Radio>().SetPromiscuous(true);
|
||||
Get<Mac::SubMac>().SetRxOnWhenIdle(true);
|
||||
otPlatAlarmMilliStop(&GetInstance());
|
||||
SuccessOrExit(error = Get<Radio>().Receive(mChannel));
|
||||
SuccessOrExit(error = Get<Radio>().SetTransmitPower(mTxPower));
|
||||
@@ -546,6 +547,7 @@ Error Diags::ProcessStop(uint8_t aArgsLength, char *aArgs[])
|
||||
otPlatAlarmMilliStop(&GetInstance());
|
||||
otPlatDiagModeSet(false);
|
||||
Get<Radio>().SetPromiscuous(false);
|
||||
Get<Mac::SubMac>().SetRxOnWhenIdle(false);
|
||||
|
||||
Output("received packets: %d\r\nsent packets: %d\r\n"
|
||||
"first received packet: rssi=%d, lqi=%d\r\n"
|
||||
|
||||
Reference in New Issue
Block a user