[sub-mac] fix incorrect timer configuration for energy scanning (#4538)

This fixes the implementation of Energy Scanning in case the platform
does not support it, but uses timer with microsecond resolution. This
is not the case with nRF528xx but found it during code inspection.

I've verified that after removing OT_RADIO_CAPS_ENERGY_SCAN
capability, the Energy Scan now works correctly.
This commit is contained in:
Łukasz Duda
2020-02-09 17:12:17 -08:00
committed by GitHub
parent b5b607cc1d
commit 1edde90d91
+6
View File
@@ -431,6 +431,8 @@ exit:
void SubMac::SampleRssi(void)
{
assert(!RadioSupportsEnergyScan());
int8_t rssi = GetRssi();
if (rssi != kInvalidRssiValue)
@@ -443,7 +445,11 @@ void SubMac::SampleRssi(void)
if (TimerMilli::GetNow() < mEnergyScanEndTime)
{
#if OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE
mTimer.StartAt(mTimer.GetFireTime(), kEnergyScanRssiSampleInterval * 1000UL);
#else
mTimer.StartAt(mTimer.GetFireTime(), kEnergyScanRssiSampleInterval);
#endif
}
else
{