diff --git a/examples/light-switch-app/silabs/src/LightSwitchMgr.cpp b/examples/light-switch-app/silabs/src/LightSwitchMgr.cpp index fbdaf568d5..e4debc6bb3 100644 --- a/examples/light-switch-app/silabs/src/LightSwitchMgr.cpp +++ b/examples/light-switch-app/silabs/src/LightSwitchMgr.cpp @@ -345,16 +345,10 @@ void LightSwitchMgr::AppEventHandler(AppEvent * aEvent) void LightSwitchMgr::SwitchActionEventHandler(AppEvent * aEvent) { - static bool mCurrentButtonState = false; - switch(aEvent->Type) { case AppEvent::kEventType_UpPressed: { - mCurrentButtonState = !mCurrentButtonState; - LightSwitchMgr::LightSwitchAction action = - mCurrentButtonState ? LightSwitchMgr::LightSwitchAction::On : LightSwitchMgr::LightSwitchAction::Off; - - LightSwitchMgr::GetInstance().TriggerLightSwitchAction(action); + LightSwitchMgr::GetInstance().TriggerLightSwitchAction(LightSwitchMgr::LightSwitchAction::Toggle); LightSwitchMgr::GetInstance().GenericSwitchOnInitialPress(); } break; @@ -364,7 +358,7 @@ void LightSwitchMgr::SwitchActionEventHandler(AppEvent * aEvent) #if 0 // TODO: Fix the button handling for the btn0 and btn1 case AppEvent::kEventType_DownPressed: - LightSwitchMgr::GetInstance().TriggerLightSwitchAction(action); + LightSwitchMgr::GetInstance().TriggerLevelControlAction(LevelControl::StepModeEnum::kDown); break; #endif default: