fix(ui): Admin's remote Reboot now confirms like Start OTA

Reboot fired on a single Enter with no way back, unlike Start OTA on
the same tab -- inconsistent given both take an unattended remote node
out of action for a while. Reuses the same beginConfirm() idiom.
This commit is contained in:
Jakub
2026-08-31 20:31:42 +02:00
parent 0b34eac41e
commit 8573543dd5
3 changed files with 14 additions and 7 deletions
+12 -6
View File
@@ -138,11 +138,12 @@ class AdminScreen : public UIScreen {
FullscreenMsgView _reply_view;
char _reply_text[200] = "";
// "Start OTA" confirmation -- pulls the remote out of the mesh into BLE DFU
// mode for the duration of the update, far more disruptive than the other
// one-shot actions on this tab, so unlike Reboot it doesn't fire on a bare
// Enter. Only this one action needs a confirm today, so it's special-cased
// in activateField() by command string rather than adding a generic
// "Start OTA" and "Reboot" confirmation -- both take the remote out of
// action for a while (OTA into BLE DFU mode, reboot just offline for a
// few seconds) with no way to intervene if something goes wrong on an
// unattended node, unlike the other one-shot actions on this tab. Only
// these two need a confirm today, so they're special-cased in
// activateField() by command string rather than adding a generic
// needs_confirm flag to every AdminField literal below.
PopupMenu _confirm;
const AdminField* _pending_confirm_field = nullptr;
@@ -241,6 +242,11 @@ class AdminScreen : public UIScreen {
_confirm.beginConfirm("Start OTA update?", "Start");
return;
}
if (!strcmp(f.get_cmd, "reboot")) { // see _confirm's comment
_pending_confirm_field = &f;
_confirm.beginConfirm("Reboot node?", "Reboot");
return;
}
strncpy(_cmd_text, f.get_cmd, sizeof(_cmd_text) - 1);
_cmd_text[sizeof(_cmd_text) - 1] = '\0';
sendCommand();
@@ -704,7 +710,7 @@ const AdminScreen::AdminField AdminScreen::ACTION_FIELDS[] = {
{ "Send advert", "advert", nullptr },
{ "Send zero-hop advert", "advert.zerohop", nullptr },
{ "Sync clock", "clock sync", nullptr },
{ "Reboot", "reboot", nullptr }, // disruptive + no confirm: keep off the default row
{ "Reboot", "reboot", nullptr }, // confirmed first -- see _confirm's comment
{ "Start OTA", "start ota", nullptr }, // confirmed first -- see _confirm's comment
{ "Custom command...", nullptr, nullptr },
};