Skip to content

Commit

Permalink
Add a call to start status LED timer in lock and light app for efr32 (#…
Browse files Browse the repository at this point in the history
…21751)

* Add a call to start status LED timer in lock and light app for efr32

* Restyled by whitespace

* add calls to start status led timer when sleepy mode is enabled

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Nov 17, 2023
1 parent 0aad0e0 commit 1087404
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 8 deletions.
4 changes: 2 additions & 2 deletions examples/light-switch-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void AppTask::OnIdentifyStart(Identify * identify)

#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1
sAppTask.StartStatusLEDTimer();
#endif // CHIP_DEVICE_CONFIG_ENABLE_SED
#endif
}

void AppTask::OnIdentifyStop(Identify * identify)
Expand All @@ -213,7 +213,7 @@ void AppTask::OnIdentifyStop(Identify * identify)

#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1
sAppTask.StopStatusLEDTimer();
#endif // CHIP_DEVICE_CONFIG_ENABLE_SED
#endif
}

void AppTask::SwitchActionEventHandler(AppEvent * aEvent)
Expand Down
35 changes: 33 additions & 2 deletions examples/lighting-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ EmberAfIdentifyEffectIdentifier sIdentifyEffect = EMBER_ZCL_IDENTIFY_EFFECT_IDEN
namespace {
void OnTriggerIdentifyEffectCompleted(chip::System::Layer * systemLayer, void * appState)
{
ChipLogProgress(Zcl, "Trigger Identify Complete");
sIdentifyEffect = EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT;

#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1
AppTask::GetAppTask().StopStatusLEDTimer();
#endif
}
} // namespace

Expand All @@ -83,6 +88,10 @@ void OnTriggerIdentifyEffect(Identify * identify)
sIdentifyEffect = static_cast<EmberAfIdentifyEffectIdentifier>(identify->mEffectVariant);
}

#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1
AppTask::GetAppTask().StartStatusLEDTimer();
#endif

switch (sIdentifyEffect)
{
case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK:
Expand All @@ -107,8 +116,8 @@ void OnTriggerIdentifyEffect(Identify * identify)

Identify gIdentify = {
chip::EndpointId{ 1 },
[](Identify *) { ChipLogProgress(Zcl, "onIdentifyStart"); },
[](Identify *) { ChipLogProgress(Zcl, "onIdentifyStop"); },
AppTask::GetAppTask().OnIdentifyStart,
AppTask::GetAppTask().OnIdentifyStop,
EMBER_ZCL_IDENTIFY_IDENTIFY_TYPE_VISIBLE_LED,
OnTriggerIdentifyEffect,
};
Expand Down Expand Up @@ -163,6 +172,10 @@ void AppTask::AppTaskMain(void * pvParameter)
appError(err);
}

#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED)
sAppTask.StartStatusLEDTimer();
#endif

EFR32_LOG("App Task started");

while (true)
Expand All @@ -176,6 +189,24 @@ void AppTask::AppTaskMain(void * pvParameter)
}
}

void AppTask::OnIdentifyStart(Identify * identify)
{
ChipLogProgress(Zcl, "onIdentifyStart");

#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1
sAppTask.StartStatusLEDTimer();
#endif
}

void AppTask::OnIdentifyStop(Identify * identify)
{
ChipLogProgress(Zcl, "onIdentifyStop");

#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1
sAppTask.StopStatusLEDTimer();
#endif
}

void AppTask::LightActionEventHandler(AppEvent * aEvent)
{
bool initiated = false;
Expand Down
35 changes: 33 additions & 2 deletions examples/lock-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ EmberAfIdentifyEffectIdentifier sIdentifyEffect = EMBER_ZCL_IDENTIFY_EFFECT_IDEN
namespace {
void OnTriggerIdentifyEffectCompleted(chip::System::Layer * systemLayer, void * appState)
{
ChipLogProgress(Zcl, "Trigger Identify Complete");
sIdentifyEffect = EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_STOP_EFFECT;

#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1
AppTask::GetAppTask().StopStatusLEDTimer();
#endif
}

void OnTriggerIdentifyEffect(Identify * identify)
Expand All @@ -92,6 +97,10 @@ void OnTriggerIdentifyEffect(Identify * identify)
sIdentifyEffect = static_cast<EmberAfIdentifyEffectIdentifier>(identify->mEffectVariant);
}

#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1
AppTask::GetAppTask().StartStatusLEDTimer();
#endif

switch (sIdentifyEffect)
{
case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK:
Expand All @@ -116,8 +125,8 @@ void OnTriggerIdentifyEffect(Identify * identify)

Identify gIdentify = {
chip::EndpointId{ 1 },
[](Identify *) { ChipLogProgress(Zcl, "onIdentifyStart"); },
[](Identify *) { ChipLogProgress(Zcl, "onIdentifyStop"); },
AppTask::GetAppTask().OnIdentifyStart,
AppTask::GetAppTask().OnIdentifyStop,
EMBER_ZCL_IDENTIFY_IDENTIFY_TYPE_VISIBLE_LED,
OnTriggerIdentifyEffect,
};
Expand Down Expand Up @@ -242,6 +251,10 @@ void AppTask::AppTaskMain(void * pvParameter)
appError(err);
}

#if !(defined(CHIP_DEVICE_CONFIG_ENABLE_SED) && CHIP_DEVICE_CONFIG_ENABLE_SED)
sAppTask.StartStatusLEDTimer();
#endif

EFR32_LOG("App Task started");

// Users and credentials should be checked once from nvm flash on boot
Expand All @@ -258,6 +271,24 @@ void AppTask::AppTaskMain(void * pvParameter)
}
}

void AppTask::OnIdentifyStart(Identify * identify)
{
ChipLogProgress(Zcl, "onIdentifyStart");

#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1
sAppTask.StartStatusLEDTimer();
#endif
}

void AppTask::OnIdentifyStop(Identify * identify)
{
ChipLogProgress(Zcl, "onIdentifyStop");

#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1
sAppTask.StopStatusLEDTimer();
#endif
}

void AppTask::LockActionEventHandler(AppEvent * aEvent)
{
bool initiated = false;
Expand Down
4 changes: 2 additions & 2 deletions examples/thermostat/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void AppTask::OnIdentifyStart(Identify * identify)

#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1
sAppTask.StartStatusLEDTimer();
#endif // CHIP_DEVICE_CONFIG_ENABLE_SED
#endif
}

void AppTask::OnIdentifyStop(Identify * identify)
Expand All @@ -198,7 +198,7 @@ void AppTask::OnIdentifyStop(Identify * identify)

#if CHIP_DEVICE_CONFIG_ENABLE_SED == 1
sAppTask.StopStatusLEDTimer();
#endif // CHIP_DEVICE_CONFIG_ENABLE_SED
#endif
}

void AppTask::ThermostatActionEventHandler(AppEvent * aEvent)
Expand Down

0 comments on commit 1087404

Please sign in to comment.