mirror of
https://github.com/espressif/openthread.git
synced 2026-10-08 16:57:39 +00:00
[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:
@@ -111,15 +111,10 @@ exit:
|
|||||||
|
|
||||||
void SubMac::SetCslParams(uint16_t aPeriod, uint8_t aChannel, ShortAddress aShortAddr, const ExtAddress &aExtAddr)
|
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;
|
mCslChannel = aChannel;
|
||||||
|
|
||||||
VerifyOrExit(diffPeriod || diffPeer);
|
VerifyOrExit((aPeriod != mCslPeriod) || (aShortAddr != mCslPeerShort));
|
||||||
|
|
||||||
mCslPeerShort = aShortAddr;
|
mCslPeerShort = aShortAddr;
|
||||||
IgnoreError(Get<Radio::Radio>().EnableCsl(aPeriod, aShortAddr, aExtAddr));
|
IgnoreError(Get<Radio::Radio>().EnableCsl(aPeriod, aShortAddr, aExtAddr));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user