diff --git a/examples/device/dfu_freertos/src/main.c b/examples/device/dfu_freertos/src/main.c index a2ada19a4..3918a9ead 100644 --- a/examples/device/dfu_freertos/src/main.c +++ b/examples/device/dfu_freertos/src/main.c @@ -186,7 +186,7 @@ static void complete_task(void* arg) if (ESP_OK != rc) { ESP_LOGE(TAG, "close OTA failed"); tud_dfu_finish_flashing(DFU_STATUS_ERR_PROG); - return; + vTaskDelete(NULL); // close task } } @@ -197,16 +197,13 @@ static void complete_task(void* arg) if (ESP_APP_DESC_MAGIC_WORD == ota_desc.magic_word) { ESP_LOGI(TAG, "set boot to valid app"); esp_ota_set_boot_partition(ota); + xTimerChangePeriod(blinky_tm, pdMS_TO_TICKS(BLINK_IDLE), 0); + tud_dfu_finish_flashing(DFU_STATUS_OK); } else { ESP_LOGI(TAG, "no valid app"); tud_dfu_finish_flashing(DFU_STATUS_ERR_VERIFY); - return; } - // flashing op for manifest is complete without error - xTimerChangePeriod(blinky_tm, pdMS_TO_TICKS(BLINK_IDLE), 0); - tud_dfu_finish_flashing(DFU_STATUS_OK); - vTaskDelete(NULL); // close task }