mirror of
https://github.com/esphome/esphome.git
synced 2025-08-06 18:37:47 +00:00
rwatchdog
This commit is contained in:
parent
0ac879ae0b
commit
8e00fedc67
@ -7,6 +7,8 @@
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#include "esp_tls_crypto.h"
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "web_server_idf.h"
|
||||
@ -226,6 +228,18 @@ esp_err_t AsyncWebServer::request_post_handler(httpd_req_t *r) {
|
||||
}
|
||||
|
||||
remaining -= recv_len;
|
||||
|
||||
// Yield periodically to allow the main loop task to run and reset its watchdog
|
||||
// The httpd thread doesn't need to reset the watchdog, but it needs to yield
|
||||
// so the loopTask can run and reset its own watchdog
|
||||
static int bytes_since_yield = 0;
|
||||
bytes_since_yield += recv_len;
|
||||
if (bytes_since_yield > 16 * 1024) { // Yield every 16KB
|
||||
// Use vTaskDelay(1) to yield to other tasks
|
||||
// This allows the main loop task to run and reset its watchdog
|
||||
vTaskDelay(1);
|
||||
bytes_since_yield = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Final cleanup - send final signal if upload was in progress
|
||||
|
Loading…
x
Reference in New Issue
Block a user