dfu: exit DFU mode if firmware is valid

This commit is contained in:
King Kévin 2022-07-23 13:03:21 +02:00
parent 06025a2b33
commit ecce6797a0
1 changed files with 10 additions and 0 deletions

View File

@ -98,6 +98,16 @@ esp_ota_handle_t ota_handle = 0;
int main(void)
{
board_init();
const esp_partition_t *next = esp_ota_get_next_update_partition(NULL);
esp_app_desc_t next_desc;
esp_ota_get_partition_description(next, &next_desc);
if (ESP_APP_DESC_MAGIC_WORD == next_desc.magic_word) {
ESP_LOGI(TAG, "boot set to valid app");
esp_ota_set_boot_partition(next);
} else {
ESP_LOGI(TAG, "no valid app");
}
// soft timer for blinky
blinky_tm = xTimerCreateStatic(NULL, pdMS_TO_TICKS(BLINK_NOT_MOUNTED), true, NULL, led_blinky_cb, &blinky_tmdef);