Skip to content

Commit

Permalink
fix restyle
Browse files Browse the repository at this point in the history
  • Loading branch information
wy-hh committed Sep 21, 2023
1 parent 0a8279e commit 8a350b7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
23 changes: 15 additions & 8 deletions examples/lighting-app/bouffalolab/common/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ void AppTask::AppTaskMain(void * pvParameter)
ef_set_env_blob(APP_REBOOT_RESET_COUNT_KEY, &resetCnt, sizeof(resetCnt));
#endif

GetAppTask().sTimer = xTimerCreate("lightTmr", pdMS_TO_TICKS(APP_TIMER_EVENT_DEFAULT_ITVL), false, NULL, AppTask::TimerCallback);
GetAppTask().sTimer =
xTimerCreate("lightTmr", pdMS_TO_TICKS(APP_TIMER_EVENT_DEFAULT_ITVL), false, NULL, AppTask::TimerCallback);
if (GetAppTask().sTimer == NULL)
{
ChipLogError(NotSpecified, "Failed to create timer task");
Expand Down Expand Up @@ -340,7 +341,8 @@ void AppTask::TimerEventHandler(app_event_t event)
{
pressedTime = System::SystemClock().GetMonotonicMilliseconds64().count() - GetAppTask().mButtonPressedTime;
#ifdef BOOT_PIN_RESET
if (ButtonPressed()) {
if (ButtonPressed())
{
if (pressedTime > APP_BUTTON_PRESS_LONG)
{
GetAppTask().PostEvent(APP_EVENT_BTN_LONG);
Expand All @@ -356,7 +358,8 @@ void AppTask::TimerEventHandler(app_event_t event)
#endif
}
}
else {
else
{
if (pressedTime >= APP_BUTTON_PRESS_LONG)
{
GetAppTask().PostEvent(APP_EVENT_FACTORY_RESET);
Expand All @@ -365,7 +368,8 @@ void AppTask::TimerEventHandler(app_event_t event)
{
GetAppTask().PostEvent(APP_EVENT_BTN_SHORT);
}
else {
else
{
GetAppTask().PostEvent(APP_EVENT_LIGHTING_MASK);
}

Expand All @@ -392,8 +396,10 @@ void AppTask::TimerEventHandler(app_event_t event)
#endif
}
#ifdef BOOT_PIN_RESET
else {
if (ButtonPressed()) {
else
{
if (ButtonPressed())
{
GetAppTask().mTimerIntvl = APP_BUTTON_PRESSED_ITVL;
GetAppTask().mButtonPressedTime = System::SystemClock().GetMonotonicMilliseconds64().count();
}
Expand Down Expand Up @@ -462,9 +468,10 @@ bool AppTask::ButtonPressed(void)
return val == 1;
}

void AppTask::ButtonEventHandler(void * arg)
void AppTask::ButtonEventHandler(void * arg)
{
if (ButtonPressed()) {
if (ButtonPressed())
{
GetAppTask().PostEvent(APP_EVENT_BTN_ISR);
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/bouffalolab/common/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class AppTask
APP_EVENT_IDENTIFY_STOP = 0x04000000,
APP_EVENT_IDENTIFY_MASK = APP_EVENT_IDENTIFY_START | APP_EVENT_IDENTIFY_IDENTIFY | APP_EVENT_IDENTIFY_STOP,

APP_EVENT_ALL_MASK =
APP_EVENT_LIGHTING_MASK | APP_EVENT_TIMER | APP_EVENT_BTN_SHORT | APP_EVENT_BTN_LONG | APP_EVENT_BTN_ISR | APP_EVENT_IDENTIFY_MASK,
APP_EVENT_ALL_MASK = APP_EVENT_LIGHTING_MASK | APP_EVENT_TIMER | APP_EVENT_BTN_SHORT | APP_EVENT_BTN_LONG |
APP_EVENT_BTN_ISR | APP_EVENT_IDENTIFY_MASK,
};

void SetEndpointId(EndpointId endpointId)
Expand Down

0 comments on commit 8a350b7

Please sign in to comment.