From d62a5e53afb131660849640b9f7bd976b25ba792 Mon Sep 17 00:00:00 2001 From: jrhoffa Date: Tue, 27 Dec 2022 16:58:02 -0800 Subject: [PATCH] Remove unnecessary reboot delay This is unnecessary as TFTP works fine without it. Furthermore, it intermittently results in stack overflow, preventing proper reboot. --- main/ota.cpp | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/main/ota.cpp b/main/ota.cpp index 6dd399d..f5abd44 100644 --- a/main/ota.cpp +++ b/main/ota.cpp @@ -4,32 +4,11 @@ static const char *TAG = "ota"; #include #include -#include -#include - #include #include "ota.hpp" -// TODO: Stick this somewhere useful? -static void reboot_soon_task(void*) { - int delay_s = 1; - ESP_LOGI(TAG, "Rebooting in %d second%s", - delay_s, delay_s == 1 ? "" : "s"); - vTaskDelay(pdMS_TO_TICKS(delay_s * 1000)); - esp_restart(); -} - -static void reboot_soon() { - xTaskCreate( - reboot_soon_task, "reboot_task", - configMINIMAL_STACK_SIZE * 2, // TODO: Choose the best size - NULL, 1, NULL - ); -} - - class OTA_Session { public: OTA_Session() : @@ -74,7 +53,7 @@ public: ESP_LOGI(TAG, "OTA Successful"); - reboot_soon(); + esp_restart(); } bool write(const void *data, int len) {