Added ResetDB and keep only favorite commands

This commit is contained in:
HarukiToreda
2025-12-19 04:41:36 -05:00
parent 9ad7d39051
commit ac0b3613ec
3 changed files with 30 additions and 0 deletions

View File

@@ -110,6 +110,9 @@ enum MenuAction {
TOGGLE_DISPLAY_UNITS,
// Network
TOGGLE_WIFI,
// Administration
RESET_NODEDB_ALL,
RESET_NODEDB_KEEP_FAVORITES,
};
} // namespace NicheGraphics::InkHUD

View File

@@ -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;

View File

@@ -33,6 +33,7 @@ enum MenuPage : uint8_t {
NODE_CONFIG_DISPLAY,
NODE_CONFIG_BLUETOOTH,
NODE_CONFIG_POSITION,
NODE_CONFIG_ADMIN_RESET,
TIMEZONE,
APPLETS,
AUTOSHOW,