From a8f0c3dca6bfcd2cb4369bb306428381177ea854 Mon Sep 17 00:00:00 2001 From: TeTeHacko Date: Wed, 4 Nov 2026 01:25:27 +0100 Subject: [PATCH] simple_room_server: dfu, radio silence watchdog and `get boot` via NodeMaintenance Co-Authored-By: Claude Opus 5.5 --- docs/cli_commands.md | 6 +++--- examples/simple_room_server/MyMesh.cpp | 4 ++++ examples/simple_room_server/main.cpp | 10 ++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/cli_commands.md b/docs/cli_commands.md index 5f9b2f6c..0afb1e8d 100644 --- a/docs/cli_commands.md +++ b/docs/cli_commands.md @@ -718,7 +718,7 @@ so the icon and the Grafana percentage tell one story. --- -#### Radio silence watchdog (repeater and sensor) +#### Radio silence watchdog (repeater, sensor, room server) **Usage:** - `get radio.silence` - `set radio.silence ` @@ -735,7 +735,7 @@ To keep a quiet site out of a reboot loop, each such reboot doubles the threshol --- -#### Reboot into the bootloader (repeater and sensor, nRF52, local console only) +#### Reboot into the bootloader (repeater, sensor, room server; nRF52, local console only) **Usage:** - `dfu [uf2|serial|ota]` @@ -743,7 +743,7 @@ To keep a quiet site out of a reboot loop, each such reboot doubles the threshol --- -#### Why the board last reset (repeater and sensor) +#### Why the board last reset (repeater, sensor, room server) **Usage:** - `get boot` diff --git a/examples/simple_room_server/MyMesh.cpp b/examples/simple_room_server/MyMesh.cpp index d14a8545..04998e37 100644 --- a/examples/simple_room_server/MyMesh.cpp +++ b/examples/simple_room_server/MyMesh.cpp @@ -950,6 +950,10 @@ void MyMesh::handleCommand(uint32_t sender_timestamp, char *command, char *reply command += 3; } + // CUSTOM (TeTeHacko): dfu (local only), radio silence watchdog, `get boot`. + extern bool maintHandleCommand(uint32_t sender_timestamp, const char* command, char* reply); + if (maintHandleCommand(sender_timestamp, command, reply)) return; + // handle ACL related commands if (memcmp(command, "setperm ", 8) == 0) { // format: setperm {pubkey-hex} {permissions-int8} char* hex = &command[8]; diff --git a/examples/simple_room_server/main.cpp b/examples/simple_room_server/main.cpp index 65fc55ef..8bf04556 100644 --- a/examples/simple_room_server/main.cpp +++ b/examples/simple_room_server/main.cpp @@ -2,6 +2,7 @@ #include #include "MyMesh.h" +#include #ifdef ETHERNET_ENABLED #define ETHERNET_CLI_BANNER "MeshCore Room Server CLI" @@ -17,6 +18,12 @@ StdRNG fast_rng; SimpleMeshTables tables; MyMesh the_mesh(board, radio_driver, *new ArduinoMillis(), fast_rng, rtc_clock, tables); +// CUSTOM (TeTeHacko): dfu, radio silence watchdog, `get boot` -- see NodeMaintenance.h. +static NodeMaintenance maint(board, radio_driver); +bool maintHandleCommand(uint32_t sender_timestamp, const char* command, char* reply) { + return maint.handleCommand(sender_timestamp, command, reply); +} + void halt() { while (1) ; } @@ -31,6 +38,7 @@ void setup() { delay(1000); board.begin(); + maint.printBootDiag(); #ifdef HAS_EXTERNAL_WATCHDOG external_watchdog.begin(); @@ -86,6 +94,7 @@ void setup() { sensors.begin(); the_mesh.begin(fs); + maint.begin(fs, the_mesh.getNodePrefs(), &the_mesh); #ifdef DISPLAY_CLASS ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION); @@ -157,6 +166,7 @@ void loop() { #endif the_mesh.loop(); + maint.loop(); sensors.loop(); #ifdef DISPLAY_CLASS ui_task.loop();