[csl] simplify SubMac::SetCslParams() (#13530)

This commit simplifies `SubMac::SetCslParams()` by setting `mCslChannel`
directly and using a single `VerifyOrExit` check to detect if `mCslPeriod`
or `mCslPeerShort` changed, removing redundant temporary variables and
checks.
This commit is contained in:
Abtin Keshavarzian
2026-08-20 12:53:09 -07:00
committed by GitHub
parent 4181dcd42c
commit ee80fadb9d
+2 -7
View File
@@ -111,15 +111,10 @@ exit:
void SubMac::SetCslParams(uint16_t aPeriod, uint8_t aChannel, ShortAddress aShortAddr, const ExtAddress &aExtAddr)
{
bool diffPeriod = aPeriod != mCslPeriod;
bool diffChannel = aChannel != mCslChannel;
bool diffPeer = aShortAddr != mCslPeerShort;
bool retval = diffPeriod || diffChannel || diffPeer;
VerifyOrExit(retval);
mCslChannel = aChannel;
VerifyOrExit(diffPeriod || diffPeer);
VerifyOrExit((aPeriod != mCslPeriod) || (aShortAddr != mCslPeerShort));
mCslPeerShort = aShortAddr;
IgnoreError(Get<Radio::Radio>().EnableCsl(aPeriod, aShortAddr, aExtAddr));