Skip to content

Commit 82913b9

Browse files
committed
bt_spp_ota: stop vfx output during the ota updating
1 parent f7540d1 commit 82913b9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

main/src/user/bt_app_spp.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
static const esp_spp_sec_t sec_mask = ESP_SPP_SEC_AUTHENTICATE;
3333
static const esp_spp_role_t role_slave = ESP_SPP_ROLE_SLAVE;
3434

35+
static uint8_t vfx_prev_mode = 0;
3536
static uint8_t ota_running = 0;
3637
static long image_length = 0;
3738
static long data_recv = 0;
@@ -80,6 +81,8 @@ void bt_app_spp_cb(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)
8081

8182
ota_running = 0;
8283
image_length = 0;
84+
85+
vfx_set_mode(vfx_prev_mode);
8386
}
8487

8588
led_set_mode(3);
@@ -108,6 +111,9 @@ void bt_app_spp_cb(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)
108111

109112
EventBits_t uxBits = xEventGroupGetBits(user_event_group);
110113
if (image_length != 0 && !(uxBits & BT_OTA_LOCKED_BIT)) {
114+
vfx_prev_mode = vfx_get_mode();
115+
vfx_set_mode(0);
116+
111117
ota_running = 1;
112118

113119
update_partition = esp_ota_get_next_update_partition(NULL);
@@ -159,16 +165,17 @@ void bt_app_spp_cb(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)
159165

160166
esp_spp_write(param->write.handle, strlen(rsp_str[1]), (uint8_t *)rsp_str[1]);
161167

162-
ota_running = 0;
163-
image_length = 0;
168+
goto exit;
164169
} else if (data_recv > image_length) {
165170
err1:
166171
esp_ota_end(update_handle);
167172
err0:
168173
esp_spp_write(param->write.handle, strlen(rsp_str[2]), (uint8_t *)rsp_str[2]);
169-
174+
exit:
170175
ota_running = 0;
171176
image_length = 0;
177+
178+
vfx_set_mode(vfx_prev_mode);
172179
}
173180
}
174181
break;

0 commit comments

Comments
 (0)