Skip to content

Commit

Permalink
refactor function so that it can be used outside of the reboot
Browse files Browse the repository at this point in the history
  • Loading branch information
mkardous-silabs committed Feb 7, 2024
1 parent 2f0c7c9 commit d6088af
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/app/icd/server/ICDManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,14 @@ void ICDManager::TriggerCheckInMessages()
{
VerifyOrReturn(SupportsFeature(Feature::kCheckInProtocolSupport));

// Check if we have any Check-In messages to send.
// If we have Check-In messages to send, transition the device to active mode.
// If we don't have any Check-In messages to send, leave the device in or transition it to idle mode.
mOperationalState = CheckInMessagesWouldBeSent() ? OperationalState::IdleMode : OperationalState::ActiveMode;
UpdateOperationState(TOGGLE_STATE(mOperationalState));
// Only trigger Check-In messages when we are in IdleMode.
// If we are already in ActiveMode, Check-In messages have already been sent.
VerifyOrReturn(mOperationalState == OperationalState::IdleMode);

// If we don't have any Check-In messages to send, do nothing
VerifyOrReturn(CheckInMessagesWouldBeSent());

UpdateOperationState(OperationalState::ActiveMode);
}

} // namespace app
Expand Down

0 comments on commit d6088af

Please sign in to comment.