[sub-mac] rename CslReceiver::HandleTimer() to ScheduleSampleWindow() (#13615)

The method `SubMac::CslReceiver::HandleTimer()` determines the current
CSL sample window, schedules radio reception, advances the sample time
to the next period, and re-arms the timer.

Besides timer expiration, this method is also called directly from:
- `SetParams()` to schedule the initial sample window when CSL is enabled.
- `RestartTimerAfterSyncUpdate()` to re-evaluate and reschedule the window
  following a sync update.

Calling `HandleTimer()` directly from these non-timer contexts was
semantically misleading. This commit renames the method to
`ScheduleSampleWindow()`, which accurately reflects its role as
advancing and scheduling the CSL sample window, with `HandleTimer()`
simply delegating to `ScheduleSampleWindow()`.
This commit is contained in:
Abtin Keshavarzian
2026-09-17 07:49:48 -07:00
committed by GitHub
parent b8f0b95a8d
commit 11048de668
2 changed files with 7 additions and 6 deletions
+2 -1
View File
@@ -632,7 +632,7 @@ private:
void SetParams(uint16_t aPeriod, uint8_t aChannel, ShortAddress aShortAddr, const ExtAddress &aExtAddr);
void ProcessTxDone(const TxFrame::ParseInfo &aFrameInfo, RxFrame *aAckFrame);
void ProcessRxFrame(const RxFrame &aFrame);
void HandleTimer(void);
void HandleTimer(void) { ScheduleSampleWindow(); }
const CslAccuracy &GetParentAccuracy(void) const { return mParentAccuracy; }
void SetParentAccuracy(const CslAccuracy &aCslAccuracy) { mParentAccuracy = aCslAccuracy; }
@@ -650,6 +650,7 @@ private:
void RestartTimerAfterSyncUpdate(void);
void SetLastSyncToNow(void);
void ScheduleSampleWindow(void);
void DetermineWindow(const Radio::SyncedTime &aSampleTime, Window &aWindow) const;
uint32_t DetermineClockDrift(uint32_t aIntervalUs) const;
bool IsEnabled(void) const { return mPeriod > 0; }
+5 -5
View File
@@ -72,12 +72,12 @@ void SubMac::CslReceiver::RestartTimerAfterSyncUpdate(void)
mTimer.Stop();
// Rewind sample times by one period. HandleTimer() will add this
// period back, effectively re-evaluating the current CSL period's
// Rewind sample times by one period. `ScheduleSampleWindow()` will add
// this period back, effectively re-evaluating the current CSL period's
// schedule using the updated mLastSync.
mSampleTime -= periodUs;
HandleTimer();
ScheduleSampleWindow();
}
}
@@ -146,7 +146,7 @@ void SubMac::CslReceiver::SetParams(uint16_t aPeriod,
#else
mLastSync = mSampleTime.GetAsTime64();
#endif
HandleTimer();
ScheduleSampleWindow();
}
else
{
@@ -157,7 +157,7 @@ exit:
return;
}
void SubMac::CslReceiver::HandleTimer(void)
void SubMac::CslReceiver::ScheduleSampleWindow(void)
{
Window window;