feat(Telemetry,Networking,OTAManager,CommunicationRouter): diagnostics report — CPU temp, WiFi reconnects, OTA state, stack high-water mark

Console requested four more Health-tab metrics beyond F-054's free_heap/ping
work. None needed 30s heartbeat freshness, so this adds a separate low-frequency
report instead of growing the heartbeat further: published every 5 min to
status/info (diagnostics_report) and queryable on-demand via a new
telemetry.get_diagnostics command.

Only CPU temperature needs local sampling (15s, via a min/max/avg RunningStats
accumulator on Telemetry) — a thermal spike could occur and subside entirely
within a 5-minute gap. The other three fields are monotonic/self-tracking
(WiFi reconnect counter, FreeRTOS's own stack high-water mark, rarely-changing
OTA state) so a single read at report time loses no information.

Verified: pio run on all four board variants.
This commit is contained in:
2026-07-17 13:09:16 +03:00
parent 9cd6b142ef
commit 959cb77d81
14 changed files with 388 additions and 9 deletions
@@ -4,16 +4,22 @@
#include "../ICommandHandler.hpp"
class Telemetry;
class OTAManager;
class Networking;
class TelemetryHandler : public ICommandHandler {
public:
explicit TelemetryHandler(Telemetry& telemetry);
// otaManager/networking are needed only for telemetry.get_diagnostics —
// the on-demand mirror of CommunicationRouter's periodic diagnostics_report.
TelemetryHandler(Telemetry& telemetry, OTAManager& otaManager, Networking& networking);
std::vector<String> commands() const override;
CommandResult execute(const CommandEnvelope& envelope) override;
private:
Telemetry& _telemetry;
OTAManager& _otaManager;
Networking& _networking;
CommandResult handleGetStrikes(const CommandEnvelope& e);
CommandResult handleResetStrikes(const CommandEnvelope& e);
@@ -23,4 +29,5 @@ private:
CommandResult handleGetMetrics(const CommandEnvelope& e);
CommandResult handleResetMetrics(const CommandEnvelope& e);
CommandResult handleGetBootHistory(const CommandEnvelope& e);
CommandResult handleGetDiagnostics(const CommandEnvelope& e);
};