From 645fbcd400d2e6c2de641bccb0335e3eaaed1f36 Mon Sep 17 00:00:00 2001 From: Eduardo Montoya Date: Tue, 10 May 2022 18:11:27 +0200 Subject: [PATCH] [csl] allow scheduling delayed reception in any radio state (#7677) When radio supports receive timing it makes no sense to restrict scheduling future reception slots while the radio state is for instance transmitting or receiving, as long as CSL parameters are properly configured. --- src/core/mac/sub_mac.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/core/mac/sub_mac.cpp b/src/core/mac/sub_mac.cpp index c345dc3cc..eb7c064db 100644 --- a/src/core/mac/sub_mac.cpp +++ b/src/core/mac/sub_mac.cpp @@ -1165,18 +1165,19 @@ void SubMac::HandleCslTimer(void) } Get().UpdateCslSampleTime(mCslSampleTime.GetValue()); - if (mState == kStateCslSample) + + if (RadioSupportsReceiveTiming()) { - if (RadioSupportsReceiveTiming()) + if (mState != kStateDisabled && mCslChannel) { IgnoreError(Get().ReceiveAt(mCslChannel, mCslSampleTime.GetValue() - periodUs - timeAhead, timeAhead + timeAfter)); } - else - { - IgnoreError(Get().Receive(mCslChannel)); - LogDebg("CSL sample %u, duration %u", mCslTimer.GetNow().GetValue(), timeAhead + timeAfter); - } + } + else if (mState == kStateCslSample) + { + IgnoreError(Get().Receive(mCslChannel)); + LogDebg("CSL sample %u, duration %u", mCslTimer.GetNow().GetValue(), timeAhead + timeAfter); } break;