mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +01:00
fix: only touch the task watchdog from tasks that are subscribed to it
Only loop() is subscribed. setConnected() runs on the WiFi event task and reached SocketEmitter::endEmit(), whose plain esp_task_wdt_reset() logged "esp_task_wdt_reset(707): task not found" on every boot. The web and socket handlers on async_tcp did the same. /scanaps on async_tcp called esp_task_wdt_add(NULL) after the scan, subscribing a task that nothing resets, so the board could panic 15 s after a scan from the UI. TaskWdt.h resets only a subscribed task and re-adds a task after a long call only when it was watched before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e9109c56e0
commit
609cd455c6
10 changed files with 154 additions and 57 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#include <Arduino.h>
|
||||
#include <ArduinoJson.h>
|
||||
#include <esp_task_wdt.h>
|
||||
#include "TaskWdt.h"
|
||||
#include "esp_log.h"
|
||||
#include "SocketEmitter.h"
|
||||
#include "ConfigSettings.h"
|
||||
|
|
@ -112,7 +112,7 @@ void SocketEmitter::endEmit(uint8_t num) {
|
|||
uint32_t asyncId = getAsyncId(num);
|
||||
this->json.endEvent(asyncId);
|
||||
}
|
||||
esp_task_wdt_reset();
|
||||
resetTaskWdt();
|
||||
}
|
||||
void SocketEmitter::endEmitRoom(uint8_t room) {
|
||||
if(room < SOCK_MAX_ROOMS) {
|
||||
|
|
@ -136,7 +136,7 @@ void SocketEmitter::initClients() {
|
|||
uint32_t asyncId = getAsyncId(slot);
|
||||
if(asyncId != 0 && ws.hasClient(asyncId)) {
|
||||
ESP_LOGD(TAG, "Initializing Socket Client %u (asyncId=%lu)", slot, asyncId);
|
||||
esp_task_wdt_reset();
|
||||
resetTaskWdt();
|
||||
ElapsedTimer total, step;
|
||||
settings.emitSockets(slot);
|
||||
logElapsed(TAG, "Socket init settings", step.lap());
|
||||
|
|
@ -150,7 +150,7 @@ void SocketEmitter::initClients() {
|
|||
net.emitSockets(slot);
|
||||
logElapsed(TAG, "Socket init network", step.lap());
|
||||
logElapsed(TAG, "Socket init total", total.us());
|
||||
esp_task_wdt_reset();
|
||||
resetTaskWdt();
|
||||
}
|
||||
this->newClients[i] = 255;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue