Add radio diagnostics support in MyMesh and CommonCLI

Implement a new method `formatRadioDiagReply` in MyMesh to format and return radio diagnostic information. Update CommonCLI to handle the new command for retrieving radio diagnostics. Enhance the Dispatcher class with a radio watchdog feature to monitor and recover from silent radio states. Introduce new error flags and methods in the Dispatcher and RadioLibWrapper classes to support these diagnostics, improving overall radio management and troubleshooting capabilities.
This commit is contained in:
agessaman committed 2026-04-10 08:48:22 -07:00
1 parent 74e45a795c
commit 7e4f75c9a5
10 files changed
+86 -6

No files matched your search

+13
View File
@@ -58,6 +58,19 @@ void Dispatcher::loop() {
_err_flags |= ERR_EVENT_STARTRX_TIMEOUT;
}
// Radio watchdog: detect radio stuck in RX mode but not receiving any packets
if (is_recv && _radio->getLastRecvMillis() > 0) {
unsigned long silent_ms = _ms->getMillis() - _radio->getLastRecvMillis();
unsigned long since_recovery = _ms->getMillis() - last_watchdog_recovery;
if (silent_ms > RADIO_WATCHDOG_MS && since_recovery > RADIO_WATCHDOG_MS) {
_err_flags |= ERR_EVENT_RADIO_WATCHDOG;
MESH_DEBUG_PRINTLN("Radio watchdog: silent %lu ms, state=%d, recovering", silent_ms, _radio->getRadioState());
_radio->idle();
_radio->startRecv();
last_watchdog_recovery = _ms->getMillis();
}
}
if (outbound) { // waiting for outbound send to be completed
if (_radio->isSendComplete()) {
long t = _ms->getMillis() - outbound_start;