Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and jadhavrohit924 committed Jan 6, 2023
1 parent 3cb0584 commit 24f88d7
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 26 deletions.
26 changes: 12 additions & 14 deletions examples/all-clusters-app/esp32/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,12 @@ CHIP_ERROR AppTask::StartAppTask()
void AppTask::TimerEventHandler(TimerHandle_t xTimer)
{
AppEvent event;
event.mType = AppEvent::kEventType_Timer;
event.mType = AppEvent::kEventType_Timer;
event.mTimerEvent.mContext = (void *) xTimer;
event.mHandler = FunctionTimerEventHandler;
event.mHandler = FunctionTimerEventHandler;
sAppTask.PostEvent(&event);
}


void AppTask::FunctionTimerEventHandler(AppEvent * aEvent)
{
if (aEvent->mType != AppEvent::kEventType_Timer)
Expand All @@ -81,17 +80,17 @@ void AppTask::FunctionTimerEventHandler(AppEvent * aEvent)
// initiate factory reset
if (sAppTask.mFunctionTimerActive && sAppTask.mFunction == kFunction_StartBleAdv)
{
//ESP_LOGI(TAG, "Factory Reset Triggered. Release button within %ums to cancel.", FACTORY_RESET_CANCEL_WINDOW_TIMEOUT);
// ESP_LOGI(TAG, "Factory Reset Triggered. Release button within %ums to cancel.", FACTORY_RESET_CANCEL_WINDOW_TIMEOUT);
// Start timer for FACTORY_RESET_CANCEL_WINDOW_TIMEOUT to allow user to
// cancel, if required.
sAppTask.StartTimer(FACTORY_RESET_CANCEL_WINDOW_TIMEOUT);
sAppTask.mFunction = kFunction_FactoryReset;
// Turn off all LEDs before starting blink to make sure blink is
// co-ordinated.
//sStatusLED.Set(false);
//sLockLED.Set(false);
//sStatusLED.Blink(500);
//sLockLED.Blink(500);
// sStatusLED.Set(false);
// sLockLED.Set(false);
// sStatusLED.Blink(500);
// sLockLED.Blink(500);
}
else if (sAppTask.mFunctionTimerActive && sAppTask.mFunction == kFunction_FactoryReset)
{
Expand Down Expand Up @@ -143,7 +142,7 @@ void AppTask::ActionInitiated(BoltLockManager::Action_t aAction, int32_t aActor)
{
sAppTask.mSyncClusterToButtonAction = true;
}
//sLockLED.Blink(50, 50);
// sLockLED.Blink(50, 50);
}
void AppTask::ActionCompleted(BoltLockManager::Action_t aAction)
{
Expand All @@ -153,16 +152,15 @@ void AppTask::ActionCompleted(BoltLockManager::Action_t aAction)
if (aAction == BoltLockManager::LOCK_ACTION)
{
ESP_LOGI(TAG, "Lock Action has been completed");
//sLockLED.Set(true);
// sLockLED.Set(true);
}
else if (aAction == BoltLockManager::UNLOCK_ACTION)
{
ESP_LOGI(TAG, "Unlock Action has been completed");
//sLockLED.Set(false);
// sLockLED.Set(false);
}
}


CHIP_ERROR AppTask::Init()
{
/* Print chip information */
Expand All @@ -174,8 +172,8 @@ CHIP_ERROR AppTask::Init()
ESP_LOGI(TAG, "%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024),
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");

// Create FreeRTOS sw timer for Function Selection
sFunctionTimer = xTimerCreate("FnTmr", // Just a text name, not used by the RTOS kernel
// Create FreeRTOS sw timer for Function Selection
sFunctionTimer = xTimerCreate("FnTmr", // Just a text name, not used by the RTOS kernel
1, // == default timer period (mS)
false, // no timer reload (==one-shot)
(void *) this, // init timer id = app task obj context
Expand Down
2 changes: 1 addition & 1 deletion examples/all-clusters-app/esp32/main/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

#pragma once
#include <lock/AppEvent.h>
#include <platform/CHIPDeviceLayer.h>
#include <lock/BoltLockManager.h>
#include <platform/CHIPDeviceLayer.h>

// Application-defined error codes in the CHIP_ERROR space.
#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01)
Expand Down
14 changes: 7 additions & 7 deletions examples/lock-app/esp32/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
*/

#include "AppTask.h"
#include <lock/AppConfig.h>
#include <lock/AppEvent.h>
#include "Button.h"
#include "LEDWidget.h"
#include "esp_log.h"
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <lock/AppConfig.h>
#include <lock/AppEvent.h>
//#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/server/OnboardingCodesUtil.h>
Expand Down Expand Up @@ -61,7 +61,7 @@ StackType_t appStack[APP_TASK_STACK_SIZE / sizeof(StackType_t)];

using namespace ::chip::DeviceLayer;
using namespace ::chip::System;
//using namespace ESP32DoorLock::LockInitParams;
// using namespace ESP32DoorLock::LockInitParams;

AppTask AppTask::sAppTask;

Expand Down Expand Up @@ -258,9 +258,9 @@ void AppTask::ButtonEventHandler(uint8_t btnIdx, uint8_t btnAction)
void AppTask::TimerEventHandler(TimerHandle_t xTimer)
{
AppEvent event;
event.mType = AppEvent::kEventType_Timer;
event.mType = AppEvent::kEventType_Timer;
event.mTimerEvent.mContext = (void *) xTimer;
event.mHandler = FunctionTimerEventHandler;
event.mHandler = FunctionTimerEventHandler;
sAppTask.PostEvent(&event);
}

Expand Down Expand Up @@ -428,10 +428,10 @@ void AppTask::ActionCompleted(BoltLockManager::Action_t aAction)
void AppTask::PostLockActionRequest(int32_t aActor, BoltLockManager::Action_t aAction)
{
AppEvent event;
event.mType = AppEvent::kEventType_Lock;
event.mType = AppEvent::kEventType_Lock;
event.mLockEvent.mActor = aActor;
event.mLockEvent.mAction = aAction;
event.mHandler = LockActionEventHandler;
event.mHandler = LockActionEventHandler;
PostEvent(&event);
}

Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/esp32/main/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#define APP_ERROR_STOP_TIMER_FAILED CHIP_APPLICATION_ERROR(0x06)
#define APP_ERROR_ALLOCATION_FAILED CHIP_APPLICATION_ERROR(0x07)


class AppTask
{

Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/esp32/main/include/Button.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

#pragma once

#include <stdint.h>
#include "driver/gpio.h"
#include "AppTask.h"
#include "driver/gpio.h"
#include "freertos/FreeRTOS.h"
#include <stdint.h>

class Button
{
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/esp32/lock/BoltLockManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ void BoltLockManager::TimerEventHandler(TimerHandle_t xTimer)
// once sLockTimer expires. Post an event to apptask queue with the actual handler
// so that the event can be handled in the context of the apptask.
AppEvent event;
event.mType = AppEvent::kEventType_Timer;
event.mType = AppEvent::kEventType_Timer;
event.mTimerEvent.mContext = lock;
if (lock->mAutoLockTimerArmed)
{
Expand Down

0 comments on commit 24f88d7

Please sign in to comment.