From 30296ddda91865550f5df1e9fac700c0b74d433d Mon Sep 17 00:00:00 2001 From: Doru Gucea Date: Fri, 20 Sep 2024 15:54:34 +0300 Subject: [PATCH] [mcxw71_k32w1] lit icd: simplify code around ButtonManager Signed-off-by: Doru Gucea --- .../nxp/mcxw71_k32w1/button/ButtonManager.cpp | 11 +++-------- .../platform/nxp/mcxw71_k32w1/button/ButtonManager.h | 3 +++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/examples/platform/nxp/mcxw71_k32w1/button/ButtonManager.cpp b/examples/platform/nxp/mcxw71_k32w1/button/ButtonManager.cpp index 8bc61eeba64e72..c94e6e44fe71b6 100644 --- a/examples/platform/nxp/mcxw71_k32w1/button/ButtonManager.cpp +++ b/examples/platform/nxp/mcxw71_k32w1/button/ButtonManager.cpp @@ -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) { @@ -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; } @@ -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) diff --git a/examples/platform/nxp/mcxw71_k32w1/button/ButtonManager.h b/examples/platform/nxp/mcxw71_k32w1/button/ButtonManager.h index 7f4f6cf81d94d3..4ed6553d10d495 100644 --- a/examples/platform/nxp/mcxw71_k32w1/button/ButtonManager.h +++ b/examples/platform/nxp/mcxw71_k32w1/button/ButtonManager.h @@ -25,6 +25,7 @@ #include "fsl_component_button.h" +#include #include // Application-defined error codes in the CHIP_ERROR space. @@ -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.