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
|
|
@ -28,6 +28,7 @@
|
|||
extern ConfigSettings settings;
|
||||
extern SSDPClass SSDP;
|
||||
extern rebootDelay_t rebootDelay;
|
||||
extern LoopStats loopStats;
|
||||
extern SomfyShadeController somfy;
|
||||
extern Web webServer;
|
||||
extern MqttConnection mqtt;
|
||||
|
|
@ -276,6 +277,10 @@ static void discoveryHeader(JsonFormatter &json, const model_snapshot_t &snap) {
|
|||
json.addElem("min", ESP.getMinFreeHeap());
|
||||
json.addElem("total", ESP.getHeapSize());
|
||||
json.addElem("uptime", (uint64_t)millis());
|
||||
// This runs on the web server's task, so it reports the last window the
|
||||
// loop task closed rather than reading the one it is still filling.
|
||||
json.addElem("loopRate", loopStats.publishedRate());
|
||||
json.addElem("loopMaxUs", loopStats.publishedMaxUs());
|
||||
json.endObject();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue