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
+20
View File
@@ -9,6 +9,25 @@
#include <nvs.h>
#include <esp_task_wdt.h>
const char* OTAManager::errorCodeToString(ErrorCode code) {
switch (code) {
case ErrorCode::NONE: return "NONE";
case ErrorCode::HTTP_ERROR: return "HTTP_ERROR";
case ErrorCode::VERSION_CHECK_FAILED: return "VERSION_CHECK_FAILED";
case ErrorCode::DOWNLOAD_FAILED: return "DOWNLOAD_FAILED";
case ErrorCode::INSUFFICIENT_SPACE: return "INSUFFICIENT_SPACE";
case ErrorCode::WRITE_FAILED: return "WRITE_FAILED";
case ErrorCode::VERIFICATION_FAILED: return "VERIFICATION_FAILED";
case ErrorCode::CHECKSUM_MISMATCH: return "CHECKSUM_MISMATCH";
case ErrorCode::METADATA_PARSE_FAILED: return "METADATA_PARSE_FAILED";
case ErrorCode::SIZE_MISMATCH: return "SIZE_MISMATCH";
case ErrorCode::VERSION_TOO_LOW: return "VERSION_TOO_LOW";
case ErrorCode::CHANNEL_MISMATCH: return "CHANNEL_MISMATCH";
case ErrorCode::PLAYER_ACTIVE: return "PLAYER_ACTIVE";
default: return "UNKNOWN";
}
}
OTAManager::OTAManager(ConfigManager& configManager)
: _configManager(configManager)
, _fileManager(nullptr)
@@ -225,6 +244,7 @@ void OTAManager::checkForUpdates(const String& channel) {
}
setStatus(Status::CHECKING_VERSION);
_lastCheckUptimeMs = millis();
LOG_INFO(TAG, "Checking for firmware updates in %s channel for %s...",
channel.c_str(), _configManager.getHardwareVariant().c_str());