mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
feat: report main-loop health in memStatus
memStatus now carries loopRate (loop() passes per second) and loopMaxUs (the longest pass, in microseconds) over the window since the last broadcast. Only a broadcast closes the window, so a client connecting does not wipe a slow pass before Home Assistant has seen it. /discovery is formatted on the web server's task, so its memory block reports the last closed window through atomics instead of reading the counters the loop task is still filling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
96b00b70f4
commit
ce505e93f6
6 changed files with 122 additions and 1 deletions
|
|
@ -41,6 +41,7 @@ SomfyShadeOps shadeOps;
|
|||
ShadeRequests shadeRequests(shadeOps);
|
||||
LoopQueue loopQueue;
|
||||
SnapshotSlots snapshotSlots;
|
||||
LoopStats loopStats;
|
||||
|
||||
uint32_t oldheap = 0;
|
||||
|
||||
|
|
@ -141,6 +142,9 @@ void setup() {
|
|||
void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
//uint32_t heap = ESP.getFreeHeap();
|
||||
// Times the whole pass for memStatus, including any time the loop task was
|
||||
// pre-empted, since that delays the loop too.
|
||||
ElapsedTimer pass;
|
||||
if(rebootDelay.reboot && millis() > rebootDelay.rebootTime) {
|
||||
ESP_LOGI(TAG, "Rebooting after %lums", rebootDelay.rebootTime);
|
||||
net.end();
|
||||
|
|
@ -180,4 +184,5 @@ void loop() {
|
|||
ESP.restart();
|
||||
}
|
||||
esp_task_wdt_reset();
|
||||
loopStats.record(pass.us());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue