[low-power] fix csl simulation (#5785)

On nRF platform, otPlatRadioGetNow always gets the LSB part of an
uint64_t time. However, on simulation platform, this is not the
case. So in

  if (otPlatRadioGetNow(&GetInstance()) <
    mTransmitFrame.mInfo.mTxInfo.mTxDelayBaseTime +
      mTransmitFrame.mInfo.mTxInfo.mTxDelay)

we don't get the result expected. otPlatRadioGetNow(&GetInstance()) is
a very big number on simulation platform, and mTxDelayBaseTime is the
LSB part of the rx time.
This commit is contained in:
Li Cao
2020-11-12 10:05:11 -08:00
committed by GitHub
parent d06d83ef07
commit 10086a4f56
+2 -2
View File
@@ -356,8 +356,8 @@ void SubMac::StartCsmaBackoff(void)
if (ShouldHandleTransmitTargetTime())
{
if (otPlatRadioGetNow(&GetInstance()) <
mTransmitFrame.mInfo.mTxInfo.mTxDelayBaseTime + mTransmitFrame.mInfo.mTxInfo.mTxDelay)
if (Time(static_cast<uint32_t>(otPlatRadioGetNow(&GetInstance()))) <
Time(mTransmitFrame.mInfo.mTxInfo.mTxDelayBaseTime) + mTransmitFrame.mInfo.mTxInfo.mTxDelay)
{
mTimer.StartAt(Time(mTransmitFrame.mInfo.mTxInfo.mTxDelayBaseTime),
mTransmitFrame.mInfo.mTxInfo.mTxDelay);