feat(MQTTDriver,SystemHandler): free_heap on heartbeat + ping RTT timestamp echo
Requested by the console-side agent building a device Health tab (RSSI, ping latency, free heap, restart timeline graphs). Both changes are additive and backward-compatible. publishHeartbeat() now includes free_heap (ESP.getFreeHeap()) on the existing 30s heartbeat, alongside rssi — previously free heap was only visible once per boot via boot_report, a single point rather than a trend. handlePing() previously built a JsonDocument and never used it — ping was a pure ack. It now echoes back an optional caller-supplied "ts" (epoch-millis) unchanged, plus device_uptime_ms, so the caller can compute round-trip latency as (time of receipt) - ts without needing synchronized clocks. ts is optional on both request and response, so existing callers doing a plain liveness check are unaffected. Left the existing #if HAS_RTC scoping on SystemHandler.cpp untouched, per the request — ping remains RTC-variant-only. Verified: pio run on vesper-std-v1 and agnus-v1 (confirms the HAS_RTC scoping around SystemHandler.cpp wasn't disturbed). Documented in feature-catalog.md F-054, MQTTDriver/README.md, and Communication/Handlers/README.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -416,6 +416,10 @@ void MQTTDriver::publishHeartbeat() {
|
||||
// WiFi signal strength
|
||||
payload["rssi"] = WiFi.RSSI();
|
||||
|
||||
// Free heap (bytes) — lets the console chart heap trend over time instead of
|
||||
// only seeing one sample per boot (via boot_report)
|
||||
payload["free_heap"] = ESP.getFreeHeap();
|
||||
|
||||
// Serialize to string
|
||||
String heartbeatMessage;
|
||||
serializeJson(doc, heartbeatMessage);
|
||||
|
||||
Reference in New Issue
Block a user