feat(ui): add on-device diagnostics screen (Tools > Diagnostics)

Shows packet counts by category (RX/TX), radio noise floor/RSSI/SNR,
packet-pool free count and outbound queue length, uptime, and heap/stack
headroom on a single scrollable screen.

Adds generic per-payload-type RX/TX counters to Dispatcher (mesh layer),
plus pool-free/queue-length getters, and a new DeviceDiag helper for
nRF52 heap (linker-symbol + sbrk) and stack (FreeRTOS high-water-mark)
stats — the only platform needed for the 3 in-scope boards (Wio Tracker
L1 OLED/Eink, GAT562 30S), all nRF52840.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-06-18 22:34:52 +02:00
co-authored by Claude Sonnet 4.6
parent 99cbe51797
commit 327e659d51
8 changed files with 200 additions and 2 deletions
+7
View File
@@ -123,6 +123,7 @@ class Dispatcher {
bool prev_isrecv_mode;
uint32_t n_sent_flood, n_sent_direct;
uint32_t n_recv_flood, n_recv_direct;
uint32_t n_sent_by_type[16], n_recv_by_type[16]; // indexed by getPayloadType() (4-bit field)
unsigned long tx_budget_ms;
unsigned long last_budget_update;
unsigned long duty_cycle_window_ms;
@@ -184,8 +185,14 @@ public:
uint32_t getNumSentDirect() const { return n_sent_direct; }
uint32_t getNumRecvFlood() const { return n_recv_flood; }
uint32_t getNumRecvDirect() const { return n_recv_direct; }
uint32_t getNumSentByType(uint8_t payload_type) const { return n_sent_by_type[payload_type & 0x0F]; }
uint32_t getNumRecvByType(uint8_t payload_type) const { return n_recv_by_type[payload_type & 0x0F]; }
int getPoolFreeCount() const { return _mgr->getFreeCount(); }
int getOutboundQueueLen() const { return _mgr->getOutboundTotal(); }
void resetStats() {
n_sent_flood = n_sent_direct = n_recv_flood = n_recv_direct = 0;
memset(n_sent_by_type, 0, sizeof(n_sent_by_type));
memset(n_recv_by_type, 0, sizeof(n_recv_by_type));
_err_flags = 0;
}