fix(ui): Diagnostics' Reset counters now confirms like every other destructive action

The Hold-Enter popup was a single "Reset counters" item with no Cancel
row, so one Enter zeroed all stats immediately -- the same shape the
Trail/channel/preset resets had before beginConfirm() fixed them.
This commit is contained in:
Jakub
2026-08-31 20:28:16 +02:00
parent 050633b6fc
commit d012ad7ee9
3 changed files with 6 additions and 7 deletions
@@ -498,7 +498,7 @@ A circular tab carousel of live device and mesh stats, refreshed once a second (
| Errors | Radio error flags since boot/reset — `OK`, or tokens `F` (queue full), `C` (CAD timeout), `R` (RX-start timeout) |
| RXPS wd s/h | RX duty-cycle watchdog recovery count, `soft/hard` — how many times the background watchdog has re-armed (soft) or fully reset (hard) a stuck duty-cycle sequencer. Stays `0/0` unless Settings Radio **Pwr save** is on and something actually went wrong. |
The packet counters, **Forwarded**, **Errors** and **RXPS wd s/h** are cumulative since boot. On the **Live** tab, **Hold Enter** opens a one-item *Reset counters* menu (Back dismisses it); the live readings (noise, RSSI/SNR, pool, queue, uptime) are not affected. **Cancel/Back** returns to the Tools list.
The packet counters, **Forwarded**, **Errors** and **RXPS wd s/h** are cumulative since boot. On the **Live** tab, **Hold Enter** opens a *Reset counters?* confirm (defaults to Cancel); the live readings (noise, RSSI/SNR, pool, queue, uptime) are not affected. **Cancel/Back** returns to the Tools list.
The counters make the repeater behaviour observable: **Forwarded** confirms the node is actually relaying (not just configured to), and **Pool free** / **Queue** show whether forwarding is exhausting the packet pool. See **Tools Repeater** for the relaying options.
@@ -30,7 +30,7 @@ class DiagnosticsScreen : public UIScreen {
UITask* _task;
int _scroll = 0;
uint8_t _tab = 0; // persists across visits (like BotScreen's _tab)
PopupMenu _reset_menu; // Live tab, Hold Enter → 1-item "Reset counters" action menu (Back dismisses)
PopupMenu _reset_menu; // Live tab, Hold Enter → Reset/Cancel confirm (defaults to Cancel)
enum Tab : uint8_t { TAB_LIVE, TAB_SYSTEM, TAB_FONT, TAB_COUNT };
static const char* const TAB_LABELS[TAB_COUNT];
@@ -258,8 +258,8 @@ public:
bool handleInput(char c) override {
if (_reset_menu.active) {
auto res = _reset_menu.handleInput(c); // Back/Cancel dismisses; the only item is "Reset counters"
if (res == PopupMenu::SELECTED) {
auto res = _reset_menu.handleInput(c);
if (res == PopupMenu::SELECTED && _reset_menu.selectedIndex() == 0) {
the_mesh.resetStats(); // zeroes Dispatcher per-type counters + Mesh forward count + err flags
radio_driver.resetStats(); // zeroes the radio's own counters, incl. RXPS watchdog soft/hard counts
_task->showAlert("Counters reset", 800);
@@ -271,8 +271,7 @@ public:
if (c == KEY_UP) { if (_scroll > 0) _scroll--; return true; }
if (c == KEY_DOWN) { _scroll++; return true; } // clamped in render()
if (c == KEY_CONTEXT_MENU && _tab == TAB_LIVE) { // Hold Enter — reset the live counters
_reset_menu.begin("Diagnostics", 1);
_reset_menu.addItem("Reset counters");
_reset_menu.beginConfirm("Reset counters?", "Reset");
return true;
}
if (c == KEY_CANCEL) { _task->gotoToolsScreen(); return true; }
+1 -1
View File
@@ -21,7 +21,7 @@
- **Tools Nodes refused to make a Locator target out of a node whose full public key it didn't have**, even with a perfectly good position on screen — the row you get when someone shares their location on a channel and isn't in your contacts, which is exactly the group-outing case the feature is for. One flag was standing in for two different things: "can be pinged" (needs the whole 32-byte key) and "can be identified" (needs only a 6-byte prefix, which is all a person target ever uses). Those are separate now, so **Set as target** is offered whenever the node has a position: with an identity it follows them as they move, and without one — a channel share, matched by name — it pins the place they were last seen, the same way a waypoint or a location out of a message does. **Navigate** was never restricted and is unchanged.
- **Tools Locator's target picker listed the people pinned to the Favourites Dial as its top tier**, which stopped making sense once pinning and favouriting became separate things — pinning puts something on a home page, and has nothing to say about who you'd geofence. The picker now leads with your **favourites** instead (still offered before they have a known position, so you can arm ahead of time); everyone else with a resolvable position follows, as before.
- **Hold Enter no longer doubles as a second Back key.** On Tools, Locator, Live Share, Repeater, Remote Bot, Auto-Advert, GPIO, Compass, the Dashboard config and the Messages navigate view it quietly meant "go back", while on other screens the same gesture opens a context menu — so the same long press did two unrelated things depending on where you were. It now only ever opens a menu (or does nothing where there is none), and Back is the single way back. This also applies inside an open popup, which Hold Enter used to dismiss — and, last of all, inside the on-screen keyboard: Hold Enter on Space, OK/Done or the `{}` placeholder cell used to close the keyboard exactly like Cancel; it's now a no-op there too, alongside its real jobs on Shift (caps-lock) and Backspace (clear field) and its accent popup on a Latin letter.
- **Deleting a channel, deleting a saved radio preset, and Trail's "Reset trail" all fired immediately on a single Enter, with no way back.** Deleting a contact already asks first and defaults to Cancel; these three didn't, and Reset trail was the worst of them — it wipes the entire recorded GPS trail with no undo short of a prior manual Save, more destructive than the GPS-off prompt already sitting one menu over in the same screen. All three now confirm the same way contact-delete does.
- **Deleting a channel, deleting a saved radio preset, Trail's "Reset trail", and Diagnostics' "Reset counters" all fired immediately on a single Enter, with no way back.** Deleting a contact already asks first and defaults to Cancel; these four didn't, and Reset trail was the worst of them — it wipes the entire recorded GPS trail with no undo short of a prior manual Save, more destructive than the GPS-off prompt already sitting one menu over in the same screen. All four now confirm the same way contact-delete does.
- **The one alert after a successful advert or message send didn't match the rest of the app's toasts.** `"Advert sent!"` / `"Advert failed.."` and `"Sent!"` were the only alerts anywhere with trailing punctuation; every other confirmation (`"Preset saved"`, `"Contact added"`, `"Target set"`, …) is bare. Also, unpinning something from the Favourites Dial reported which slot it came out of on some screens but not others — pinning always said so, unpinning only did from the Messages screens. Both now match the rest.
---