From e13cd8fb0afa289edaf48941f902c9ce24c4a5b8 Mon Sep 17 00:00:00 2001 From: Fengtai Xie Date: Wed, 18 Dec 2024 13:48:18 +0800 Subject: [PATCH] telink: b92: optimize code format - Optimize code format to access CI . Signed-off-by: Fengtai Xie --- examples/lighting-app/telink/src/AppTask.cpp | 4 ++-- .../telink/common/include/AppTaskCommon.h | 15 ++++++------- .../telink/common/src/AppTaskCommon.cpp | 21 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/examples/lighting-app/telink/src/AppTask.cpp b/examples/lighting-app/telink/src/AppTask.cpp index 55af0becdbf607..f8c6c1edc72380 100644 --- a/examples/lighting-app/telink/src/AppTask.cpp +++ b/examples/lighting-app/telink/src/AppTask.cpp @@ -61,9 +61,9 @@ CHIP_ERROR AppTask::Init(void) InitCommonParts(); #if CONFIG_DUAL_MODE_SWTICH - if(sBoot_zb) + if (sBoot_zb) { - /* Switch from the touch link, need to restore previous values */ + /* Switch from the touch link, need to restore previous values */ sfixture_on = user_para.onoff; sBrightness = user_para.lightness; sAppTask.UpdateClusterState(); diff --git a/examples/platform/telink/common/include/AppTaskCommon.h b/examples/platform/telink/common/include/AppTaskCommon.h index b04035a75bc7fe..c50ededcfb337b 100644 --- a/examples/platform/telink/common/include/AppTaskCommon.h +++ b/examples/platform/telink/common/include/AppTaskCommon.h @@ -43,21 +43,22 @@ #include #include -#define USER_INIT_VAL 0xff -#define USER_ZB_SW_VAL 0xaa -#define USER_MATTER_PAIR_VAL 0x55 -#define USER_PARA_MAC_OFFSET 0x100 +#define USER_INIT_VAL 0xff +#define USER_ZB_SW_VAL 0xaa +#define USER_MATTER_PAIR_VAL 0x55 +#define USER_PARA_MAC_OFFSET 0x100 #define USER_PARTITION user_para_partition #define USER_PARTITION_DEVICE FIXED_PARTITION_DEVICE(USER_PARTITION) #define USER_PARTITION_OFFSET FIXED_PARTITION_OFFSET(USER_PARTITION) #define USER_PARTITION_SIZE FIXED_PARTITION_SIZE(USER_PARTITION) -typedef struct{ - uint8_t val ; +typedef struct +{ + uint8_t val; uint8_t rfu; uint8_t onoff; uint8_t lightness; -}user_para_t; +} user_para_t; extern user_para_t user_para; extern uint8_t para_lightness; diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index 03cf7eebb1a61e..88ee0a7022fd9e 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -75,7 +75,7 @@ constexpr uint32_t kIdentifyBreatheRateMs = 1000; #if CONFIG_DUAL_MODE_SWTICH const struct device * flash_para_dev = USER_PARTITION_DEVICE; -constexpr int kDnssTimeout = 60000; +constexpr int kDnssTimeout = 60000; k_timer sDnssTimer; #endif @@ -248,25 +248,25 @@ CHIP_ERROR AppTaskCommon::StartApp(void) { #if CONFIG_DUAL_MODE_SWTICH - /* Proc ota boot flag , and erase flag */ + /* Proc ota boot flag , and erase flag */ flash_read(flash_para_dev, USER_PARTITION_OFFSET, &user_para, sizeof(user_para)); /* Boot from Zigbee , need to clean the user parameters sector first and set a flag */ if (user_para.val == USER_ZB_SW_VAL) { sBoot_zb = 1; /* Ensure lightness is at least 2 to avoid display error on HomePod Mini */ - if(user_para.lightness < 2) + if (user_para.lightness < 2) { user_para.lightness = 2; } /* Pass the value to the init part to avoid gaps in pwm_pool init */ - if(user_para.onoff) + if (user_para.onoff) { para_lightness = user_para.lightness; } k_timer_init(&sDnssTimer, &AppTask::DnssTimerTimeoutCallback, nullptr); k_timer_start(&sDnssTimer, K_MSEC(kDnssTimeout), K_NO_WAIT); - printk("Matter: start timer to protect Dnss initialized %x \r\n",*(int *)(&user_para)); + printk("Matter: start timer to protect Dnss initialized %x \r\n", *(int *) (&user_para)); } #endif @@ -812,16 +812,15 @@ void AppTaskCommon::ChipEventHandler(const ChipDeviceEvent * event, intptr_t /* #endif break; #if CONFIG_DUAL_MODE_SWTICH - case DeviceEventType::kCommissioningComplete: - { + case DeviceEventType::kCommissioningComplete: { uint8_t val = USER_MATTER_PAIR_VAL; flash_erase(flash_para_dev, USER_PARTITION_OFFSET, USER_PARTITION_SIZE); flash_write(flash_para_dev, USER_PARTITION_OFFSET, &val, 1); printk("Commissioning complete, set Matter commissionined flag"); - } - break; + } + break; case DeviceEventType::kFailSafeTimerExpired: - /* Reset to Zigbee mode if commissioning fails */ + /* Reset to Zigbee mode if commissioning fails */ if (sBoot_zb) { printk("FailSafeTimer expired, Matter commissioning failed, rebooting to Zigbee mode.\r\n"); @@ -849,7 +848,7 @@ void AppTaskCommon::ChipEventHandler(const ChipDeviceEvent * event, intptr_t /* #endif #if CONFIG_DUAL_MODE_SWTICH - if(sBoot_zb) + if (sBoot_zb) { k_timer_stop(&sDnssTimer); printk("Dnss Timer stopped, Matter commissioning kDnssdInitialized.\r\n");