Browse Source

Remove unnecessary reboot delay

This is unnecessary as TFTP works fine without it.  Furthermore, it
intermittently results in stack overflow, preventing proper reboot.
S3
jrhoffa 3 years ago
parent
commit
d62a5e53af
1 changed files with 1 additions and 22 deletions
  1. +1
    -22
      main/ota.cpp

+ 1
- 22
main/ota.cpp View File

@@ -4,32 +4,11 @@ static const char *TAG = "ota";
#include <esp_ota_ops.h> #include <esp_ota_ops.h>
#include <lwip/apps/tftp_server.h> #include <lwip/apps/tftp_server.h>


#include <freertos/FreeRTOS.h>
#include <freertos/task.h>

#include <cstring> #include <cstring>


#include "ota.hpp" #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 { class OTA_Session {
public: public:
OTA_Session() : OTA_Session() :
@@ -74,7 +53,7 @@ public:


ESP_LOGI(TAG, "OTA Successful"); ESP_LOGI(TAG, "OTA Successful");


reboot_soon();
esp_restart();
} }


bool write(const void *data, int len) { bool write(const void *data, int len) {


Loading…
Cancel
Save