Skip to content

Commit 3cb1032

Browse files
committed
main: code refactoring
1 parent c7a8d85 commit 3cb1032

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

main/src/user/ble_gatts.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
#define GATTS_OTA_TAG "gatts_ota"
2626
#define GATTS_FAN_TAG "gatts_fan"
2727

28-
#define GATTS_SRV_UUID_OTA 0xFF52
29-
#define GATTS_CHAR_UUID_OTA 0x5201
30-
#define GATTS_NUM_HANDLE_OTA 4
28+
#define GATTS_SRV_UUID_OTA 0xFF52
29+
#define GATTS_CHAR_UUID_OTA 0x5201
30+
#define GATTS_NUM_HANDLE_OTA 4
3131

32-
#define GATTS_SRV_UUID_FAN 0xFF53
33-
#define GATTS_CHAR_UUID_FAN 0x5301
34-
#define GATTS_NUM_HANDLE_FAN 4
32+
#define GATTS_SRV_UUID_FAN 0xFF53
33+
#define GATTS_CHAR_UUID_FAN 0x5301
34+
#define GATTS_NUM_HANDLE_FAN 4
3535

3636
static uint16_t desc_val_ota = 0x0000;
3737
static uint16_t desc_val_fan = 0x0000;
@@ -226,16 +226,15 @@ static void profile_fan_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t
226226
desc_val_fan = param->write.value[1] << 8 | param->write.value[0];
227227
} else {
228228
switch (param->write.value[0]) {
229-
case 0xEF: {
230-
if (param->write.len == 1) { // Restore Default Configuration
229+
case 0xEF:
230+
if (param->write.len == 1) { // restore default configuration
231231
fan_set_duty(DEFAULT_FAN_DUTY);
232-
} else if (param->write.len == 8) { // Update with New Configuration
232+
} else if (param->write.len == 8) { // apply new configuration
233233
fan_set_duty(param->write.value[6]);
234234
} else {
235235
ESP_LOGE(GATTS_FAN_TAG, "command 0x%02X error", param->write.value[0]);
236236
}
237237
break;
238-
}
239238
default:
240239
ESP_LOGW(GATTS_FAN_TAG, "unknown command: 0x%02X", param->write.value[0]);
241240
break;

main/src/user/ota.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ enum rsp_idx {
6464
RSP_IDX_OK = 0x0,
6565
RSP_IDX_FAIL = 0x1,
6666
RSP_IDX_DONE = 0x2,
67-
RSP_IDX_ERROR = 0x3,
67+
RSP_IDX_ERROR = 0x3
6868
};
6969

7070
static const char rsp_str[][32] = {
@@ -80,8 +80,8 @@ static uint32_t data_length = 0;
8080

8181
static RingbufHandle_t ota_buff = NULL;
8282

83-
static const esp_partition_t *update_partition = NULL;
8483
static esp_ota_handle_t update_handle = 0;
84+
static const esp_partition_t *update_partition = NULL;
8585

8686
static int ota_parse_command(const char *data)
8787
{

main/src/user/pwr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static char pwr_mode_str[][8] = {
3131
"DCP 5V",
3232
"QC 5V",
3333
"QC 9V",
34-
"QC 12V",
34+
"QC 12V"
3535
};
3636

3737
void pwr_set_mode(pwr_mode_t idx)

0 commit comments

Comments
 (0)