mirror of
https://github.com/esphome/esphome.git
synced 2024-12-30 17:57:43 +01:00
Increase watchdog timeout when starting OTA (#4172)
This commit is contained in:
parent
07197d12f6
commit
5d98e2923b
@ -1,6 +1,8 @@
|
|||||||
#include "esphome/core/defines.h"
|
#include "esphome/core/defines.h"
|
||||||
#ifdef USE_ESP_IDF
|
#ifdef USE_ESP_IDF
|
||||||
|
|
||||||
|
#include <esp_task_wdt.h>
|
||||||
|
|
||||||
#include "ota_backend_esp_idf.h"
|
#include "ota_backend_esp_idf.h"
|
||||||
#include "ota_component.h"
|
#include "ota_component.h"
|
||||||
#include <esp_ota_ops.h>
|
#include <esp_ota_ops.h>
|
||||||
@ -14,7 +16,9 @@ OTAResponseTypes IDFOTABackend::begin(size_t image_size) {
|
|||||||
if (this->partition_ == nullptr) {
|
if (this->partition_ == nullptr) {
|
||||||
return OTA_RESPONSE_ERROR_NO_UPDATE_PARTITION;
|
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_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) {
|
if (err != ESP_OK) {
|
||||||
esp_ota_abort(this->update_handle_);
|
esp_ota_abort(this->update_handle_);
|
||||||
this->update_handle_ = 0;
|
this->update_handle_ = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user