mirror of
https://github.com/espressif/openthread.git
synced 2026-08-28 21:09:54 +00:00
[csl] update CSL sync time whenever CSL parameters are re-initialized (#12161)
When the CSL feature is first enabled on a child device, the OpenThread stack starts CSL sampling before sending the Child Update Request packet. The last CSL sync sample time, initialized as `0`, is updated only when the Child Update Request is sent. However, since CSL sampling begins earlier, the first CSL receive operation calculates the elapsed time in `GetCslWindowEdges` using `0` as the last sync time. Similarly, when CSL parameters are re-initialized, the stack should update `mCslLastSync`. Continuing to use an outdated sync time results in inaccurate calculations and is not reasonable behavior. This commit fixed this issue.
This commit is contained in:
@@ -131,6 +131,8 @@ void SubMac::SetCslParams(uint16_t aPeriod, uint8_t aChannel, ShortAddress aShor
|
||||
{
|
||||
mCslSampleTimeRadio = static_cast<uint32_t>(Get<Radio>().GetNow());
|
||||
mCslSampleTimeLocal = TimerMicro::GetNow();
|
||||
// Update CSL sync time whenever CSL parameters are re-initialized.
|
||||
mCslLastSync = mCslSampleTimeLocal;
|
||||
|
||||
HandleCslTimer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user