From ac0b3613ecc18ccaa03e58117bb15db760a89f75 Mon Sep 17 00:00:00 2001 From: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com> Date: Fri, 19 Dec 2025 04:41:36 -0500 Subject: [PATCH] Added ResetDB and keep only favorite commands --- .../InkHUD/Applets/System/Menu/MenuAction.h | 3 +++ .../InkHUD/Applets/System/Menu/MenuApplet.cpp | 26 +++++++++++++++++++ .../InkHUD/Applets/System/Menu/MenuPage.h | 1 + 3 files changed, 30 insertions(+) diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h index f3394d9ca..4af58a018 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuAction.h @@ -110,6 +110,9 @@ enum MenuAction { TOGGLE_DISPLAY_UNITS, // Network TOGGLE_WIFI, + // Administration + RESET_NODEDB_ALL, + RESET_NODEDB_KEEP_FAVORITES, }; } // namespace NicheGraphics::InkHUD diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp index dd01296ef..4bcfdcda2 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp @@ -785,6 +785,18 @@ void InkHUD::MenuApplet::execute(MenuItem item) break; } + case RESET_NODEDB_ALL: + InkHUD::getInstance()->notifyApplyingChanges(); + nodeDB->resetNodes(); + rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000; + break; + + case RESET_NODEDB_KEEP_FAVORITES: + InkHUD::getInstance()->notifyApplyingChanges(); + nodeDB->resetNodes(1); + rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000; + break; + default: LOG_WARN("Action not implemented"); } @@ -888,6 +900,12 @@ void InkHUD::MenuApplet::showPage(MenuPage page) items.push_back(MenuItem("Display", MenuPage::NODE_CONFIG_DISPLAY)); items.push_back(MenuItem("Bluetooth", MenuPage::NODE_CONFIG_BLUETOOTH)); + + // Administration Section + items.push_back(MenuItem::Header("Administration")); + items.push_back(MenuItem("Reset NodeDB", MenuPage::NODE_CONFIG_ADMIN_RESET)); + + // Exit items.push_back(MenuItem("Exit", MenuPage::EXIT)); break; @@ -1212,7 +1230,15 @@ void InkHUD::MenuApplet::showPage(MenuPage page) items.push_back(MenuItem("Exit", MenuPage::EXIT)); break; } + // Administration Section + case NODE_CONFIG_ADMIN_RESET: + items.push_back(MenuItem("Back", MenuAction::BACK, MenuPage::NODE_CONFIG)); + items.push_back(MenuItem("Reset All", MenuAction::RESET_NODEDB_ALL, MenuPage::EXIT)); + items.push_back(MenuItem("Keep Favorites Only", MenuAction::RESET_NODEDB_KEEP_FAVORITES, MenuPage::EXIT)); + items.push_back(MenuItem("Exit", MenuPage::EXIT)); + break; + // Exit case EXIT: sendToBackground(); // Menu applet dismissed, allow normal behavior to resume break; diff --git a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuPage.h b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuPage.h index b836dfa35..dd4d81048 100644 --- a/src/graphics/niche/InkHUD/Applets/System/Menu/MenuPage.h +++ b/src/graphics/niche/InkHUD/Applets/System/Menu/MenuPage.h @@ -33,6 +33,7 @@ enum MenuPage : uint8_t { NODE_CONFIG_DISPLAY, NODE_CONFIG_BLUETOOTH, NODE_CONFIG_POSITION, + NODE_CONFIG_ADMIN_RESET, TIMEZONE, APPLETS, AUTOSHOW,