From d4e232f267c2ec3c6d4ea726412bf366e8f90ea4 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Mon, 12 Dec 2022 16:16:24 +1300 Subject: [PATCH] Increase watchdog timeout when starting OTA (#4172) --- esphome/components/ota/ota_backend_esp_idf.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/esphome/components/ota/ota_backend_esp_idf.cpp b/esphome/components/ota/ota_backend_esp_idf.cpp index 167f8c059b..2fdc00c54d 100644 --- a/esphome/components/ota/ota_backend_esp_idf.cpp +++ b/esphome/components/ota/ota_backend_esp_idf.cpp @@ -1,6 +1,8 @@ #include "esphome/core/defines.h" #ifdef USE_ESP_IDF +#include + #include "ota_backend_esp_idf.h" #include "ota_component.h" #include @@ -14,7 +16,9 @@ OTAResponseTypes IDFOTABackend::begin(size_t image_size) { if (this->partition_ == nullptr) { return OTA_RESPONSE_ERROR_NO_UPDATE_PARTITION; } + esp_task_wdt_init(15, false); // The following function takes longer than the 5 seconds timeout of WDT esp_err_t err = esp_ota_begin(this->partition_, image_size, &this->update_handle_); + esp_task_wdt_init(CONFIG_ESP_TASK_WDT_TIMEOUT_S, false); // Set the WDT back to the configured timeout if (err != ESP_OK) { esp_ota_abort(this->update_handle_); this->update_handle_ = 0;