Skip to content

Commit

Permalink
[mcxw71_k32w1] lit icd: simplify code around ButtonManager
Browse files Browse the repository at this point in the history
Signed-off-by: Doru Gucea <[email protected]>
  • Loading branch information
doru91 committed Sep 24, 2024
1 parent bfa90f3 commit 492fa5b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
11 changes: 3 additions & 8 deletions examples/platform/nxp/mcxw71_k32w1/button/ButtonManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ ButtonManager ButtonManager::sInstance;

TimerHandle_t resetTimer;

#if (CHIP_CONFIG_ENABLE_ICD_LIT && CHIP_CONFIG_ENABLE_ICD_DSLS)
static bool sitModeRequested;
#endif // CHIP_CONFIG_ENABLE_ICD_LIT && CHIP_CONFIG_ENABLE_ICD_DSLS

CHIP_ERROR ButtonManager::Init()
{
resetTimer = xTimerCreate("FnTmr", 1, false, (void *) this, [](TimerHandle_t xTimer) {
Expand All @@ -65,10 +61,6 @@ CHIP_ERROR ButtonManager::Init()
});
VerifyOrReturnError(resetTimer != NULL, APP_ERROR_CREATE_TIMER_FAILED);

#if (CHIP_CONFIG_ENABLE_ICD_LIT && CHIP_CONFIG_ENABLE_ICD_DSLS)
static bool sitModeRequested;
#endif // CHIP_CONFIG_ENABLE_ICD_LIT && CHIP_CONFIG_ENABLE_ICD_DSLS

return CHIP_NO_ERROR;
}

Expand Down Expand Up @@ -208,6 +200,9 @@ void ButtonManager::BleHandler(const AppEvent & event)
#if (CHIP_CONFIG_ENABLE_ICD_LIT && CHIP_CONFIG_ENABLE_ICD_DSLS)
void ButtonManager::DSLSActionEventHandler(const AppEvent & event)
{

static bool sitModeRequested = false;

if (chip::DeviceLayer::ConfigurationMgr().IsFullyProvisioned())
{
if (!sitModeRequested)
Expand Down
3 changes: 3 additions & 0 deletions examples/platform/nxp/mcxw71_k32w1/button/ButtonManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "fsl_component_button.h"

#include <app/icd/server/ICDServerConfig.h>
#include <lib/core/CHIPError.h>

// Application-defined error codes in the CHIP_ERROR space.
Expand Down Expand Up @@ -87,12 +88,14 @@ class ButtonManager
*/
static void ResetActionEventHandler(const AppEvent & event);

#if (CHIP_CONFIG_ENABLE_ICD_LIT && CHIP_CONFIG_ENABLE_ICD_DSLS)
/**
* @brief This callback schedules a DSLS LIT action (Dynamic SIT LIT Support).
*
* It is used when the app requests SIT mode (check spec, "Runtime Operating Mode Switching")
*/
static void DSLSActionEventHandler(const AppEvent & event);
#endif /* CHIP_CONFIG_ENABLE_ICD_LIT && CHIP_CONFIG_ENABLE_ICD_DSLS */

/**
* @brief This callback performs a factory reset.
Expand Down

0 comments on commit 492fa5b

Please sign in to comment.