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:
@@ -81,13 +81,13 @@ Full control over the Timekeeper clock subsystem and its persisted configuration
|
||||
|
||||
## SystemHandler
|
||||
|
||||
General device management. `identify` is WebSocket-only. `system.restart` defers the actual reboot to a FreeRTOS task so the reply reaches the client first.
|
||||
General device management. `identify` is WebSocket-only. `system.restart` defers the actual reboot to a FreeRTOS task so the reply reaches the client first. `ping`/`identify`/all `system.*` commands here are wrapped in `#if HAS_RTC` — this handler does not exist on non-RTC variants (e.g. `agnus_mini`).
|
||||
|
||||
**Commands:**
|
||||
|
||||
| Command | Key contents | Description |
|
||||
|---------|-------------|-------------|
|
||||
| `ping` | — | Returns `{ "status": "SUCCESS", "type": "pong" }`. |
|
||||
| `ping` | `{ "ts": 1752600000123 }` (optional) | Echoes `ts` back unchanged plus `device_uptime_ms` (`millis()`), so the caller can compute round-trip time as `(time of response receipt) − ts` without needing synchronized clocks. Returns `{ "status": "SUCCESS", "type": "pong", "data": { "ts": 1752600000123, "device_uptime_ms": 184213 } }`. `ts` is omitted from the response if the caller didn't send one — fully backward compatible with callers that just want a liveness ack. |
|
||||
| `identify` | `{ "device_type": "master"\|"secondary" }` | WebSocket only. Classifies the calling client in `ClientManager`. |
|
||||
| `system.status` | — | Player status, time elapsed, projected run time, 16 strike counters. |
|
||||
| `system.get_time` | — | Local and UTC timestamps, broken-down time fields, `rtc_available`. |
|
||||
|
||||
Reference in New Issue
Block a user