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
+8
View File
@@ -103,6 +103,13 @@ public:
SemVer getCurrentVersion() const;
SemVer getAvailableVersion() const { return _availableVersion; }
bool isUpdateAvailable() const { return _updateAvailable; }
// millis() at the start of the most recent update-check attempt (scheduled,
// emergency, or manual), or 0 if no check has run yet this boot.
uint32_t getLastCheckUptimeMs() const { return _lastCheckUptimeMs; }
// Human-readable name for an ErrorCode, e.g. "DOWNLOAD_FAILED". Used by
// diagnostics_report and telemetry.get_diagnostics.
static const char* errorCodeToString(ErrorCode code);
// Callbacks
void setProgressCallback(ProgressCallback callback) { _progressCallback = callback; }
@@ -129,6 +136,7 @@ private:
SemVer _minVersion;
size_t _expectedFileSize; // NEW: Expected firmware file size
bool _updateAvailable;
uint32_t _lastCheckUptimeMs = 0; // See getLastCheckUptimeMs()
String _availableChecksum;
String _availableDownloadPath; // Relative path from backend (e.g. /api/firmware/.../firmware.bin)
String _updateChannel;