feat(repeater): report the TX-failure counters in the RF status reply

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5 committed 2026-08-19 19:42:20 +02:00
1 parent e06d95ed22
commit 0d8ca69d69
2 files changed
+22

No files matched your search

+2
View File
@@ -497,6 +497,8 @@ int MyMesh::handleRequest(ClientInfo *sender, uint32_t sender_timestamp, uint8_t
stats.n_flood_dups = ((SimpleMeshTables *)getTables())->getNumFloodDups();
stats.total_rx_air_time_secs = getReceiveAirTime() / 1000;
stats.n_recv_errors = radio_driver.getPacketsRecvErrors();
stats.n_tx_start_fail = getNumTxStartFail(); // CUSTOM (TeTeHacko)
stats.n_tx_timeout = getNumTxTimeout(); // CUSTOM (TeTeHacko)
memcpy(&reply_data[4], &stats, sizeof(stats));
return 4 + sizeof(stats); // reply_len
+20
View File
@@ -57,8 +57,28 @@ struct RepeaterStats {
uint16_t n_direct_dups, n_flood_dups;
uint32_t total_rx_air_time_secs;
uint32_t n_recv_errors;
// CUSTOM (TeTeHacko): appended at the END on purpose. Clients parse this
// struct by fixed offsets, so fields added here are simply invisible to older
// ones instead of shifting everything after them -- the same way upstream
// grew its companion stats frame (docs/stats_binary_frames.md documents a
// 26-byte "legacy" and a 30-byte frame that appends recv_errors).
//
// These two come from the Dispatcher requeue counters. Without them a
// repeater that keeps failing to get its transmits out looks perfectly
// healthy in every other field: sent/airtime just stop growing, and there is
// nothing in the status that says why.
uint32_t n_tx_start_fail, n_tx_timeout;
};
// This struct goes on the air byte-for-byte, so its size is part of the
// protocol: 56 bytes up to n_recv_errors (what upstream clients expect and
// gate on -- meshcore-py's parse_status() reads recv_errors only
// `if len(data) >= offset + 56`), plus the 8 appended here. Reordering a field
// or letting the compiler insert padding would silently shift every offset
// after it, so pin the number instead of trusting review.
static_assert(sizeof(RepeaterStats) == 64,
"RepeaterStats is a wire format: append only, keep it padding-free");
#ifndef MAX_CLIENTS
#define MAX_CLIENTS 32
#endif