diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 9c64578e3..9e1318f2c 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -827,22 +827,27 @@ void Screen::setFrames(FrameFocus focus) indicatorIcons.push_back(icon_mail); #ifndef USE_EINK + fsi.positions.nodelist = numframes; normalFrames[numframes++] = graphics::NodeListRenderer::drawDynamicNodeListScreen; indicatorIcons.push_back(icon_nodes); #endif // Show detailed node views only on E-Ink builds #ifdef USE_EINK + fsi.positions.nodelist_lastheard = numframes; normalFrames[numframes++] = graphics::NodeListRenderer::drawLastHeardScreen; indicatorIcons.push_back(icon_nodes); + fsi.positions.nodelist_hopsignal = numframes; normalFrames[numframes++] = graphics::NodeListRenderer::drawHopSignalScreen; indicatorIcons.push_back(icon_signal); + fsi.positions.nodelist_distance = numframes; normalFrames[numframes++] = graphics::NodeListRenderer::drawDistanceScreen; indicatorIcons.push_back(icon_distance); #endif #if HAS_GPS + fsi.positions.nodelist_bearings = numframes; normalFrames[numframes++] = graphics::NodeListRenderer::drawNodeListWithCompasses; indicatorIcons.push_back(icon_list); @@ -1272,6 +1277,13 @@ int Screen::handleInputEvent(const InputEvent *event) this->ui->getUiState()->currentFrame >= framesetInfo.positions.firstFavorite && this->ui->getUiState()->currentFrame <= framesetInfo.positions.lastFavorite) { menuHandler::favoriteBaseMenu(); + } else if (this->ui->getUiState()->currentFrame == framesetInfo.positions.nodelist || + this->ui->getUiState()->currentFrame == framesetInfo.positions.nodelist_lastheard || + this->ui->getUiState()->currentFrame == framesetInfo.positions.nodelist_hopsignal || + this->ui->getUiState()->currentFrame == framesetInfo.positions.nodelist_distance || + this->ui->getUiState()->currentFrame == framesetInfo.positions.nodelist_hopsignal || + this->ui->getUiState()->currentFrame == framesetInfo.positions.nodelist_bearings) { + menuHandler::nodeListMenu(); } } else if (event->inputEvent == INPUT_BROKER_BACK) { showPrevFrame(); diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index 8a1a71334..4a0de0d24 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -609,7 +609,6 @@ class Screen : public concurrency::OSThread struct FramesetInfo { struct FramePositions { uint8_t fault = 255; - uint8_t textMessage = 255; uint8_t waypoint = 255; uint8_t focusedModule = 255; uint8_t log = 255; @@ -619,6 +618,12 @@ class Screen : public concurrency::OSThread uint8_t memory = 255; uint8_t gps = 255; uint8_t home = 255; + uint8_t textMessage = 255; + uint8_t nodelist = 255; + uint8_t nodelist_lastheard = 255; + uint8_t nodelist_hopsignal = 255; + uint8_t nodelist_distance = 255; + uint8_t nodelist_bearings = 255; uint8_t clock = 255; uint8_t firstFavorite = 255; uint8_t lastFavorite = 255; diff --git a/src/graphics/draw/MenuHandler.cpp b/src/graphics/draw/MenuHandler.cpp index be1b84bac..3af6343dd 100644 --- a/src/graphics/draw/MenuHandler.cpp +++ b/src/graphics/draw/MenuHandler.cpp @@ -10,6 +10,7 @@ #include "graphics/Screen.h" #include "graphics/draw/UIRenderer.h" #include "main.h" +#include "modules/AdminModule.h" #include "modules/CannedMessageModule.h" namespace graphics @@ -310,6 +311,29 @@ void menuHandler::positionBaseMenu() }); } +void menuHandler::nodeListMenu() +{ + static const char *optionsArray[] = {"Back", "Reset NodeDB"}; + screen->showOverlayBanner("Node Options", 30000, optionsArray, 2, [](int selected) -> void { + if (selected == 1) { + menuQueue = reset_node_db_menu; + } + }); +} + +void menuHandler::resetNodeDBMenu() +{ + static const char *optionsArray[] = {"Back", "Confirm"}; + screen->showOverlayBanner("Confirm Reset NodeDB", 30000, optionsArray, 2, [](int selected) -> void { + if (selected == 1) { + disableBluetooth(); + LOG_INFO("Initiate node-db reset"); + nodeDB->resetNodes(); + rebootAtMsec = (millis() + DEFAULT_REBOOT_SECONDS * 1000); + } + }); +} + void menuHandler::compassNorthMenu() { static const char *optionsArray[] = {"Back", "Points Up", "Dynamic"}; @@ -405,6 +429,9 @@ void menuHandler::handleMenuSwitch() case compass_point_north_menu: compassNorthMenu(); break; + case reset_node_db_menu: + resetNodeDBMenu(); + break; } menuQueue = menu_none; } diff --git a/src/graphics/draw/MenuHandler.h b/src/graphics/draw/MenuHandler.h index 46016c30e..a5bea5176 100644 --- a/src/graphics/draw/MenuHandler.h +++ b/src/graphics/draw/MenuHandler.h @@ -14,7 +14,8 @@ class menuHandler clock_menu, position_base_menu, gps_toggle_menu, - compass_point_north_menu + compass_point_north_menu, + reset_node_db_menu }; static screenMenus menuQueue; @@ -32,6 +33,8 @@ class menuHandler static void GPSToggleMenu(); static void BuzzerModeMenu(); static void switchToMUIMenu(); + static void nodeListMenu(); + static void resetNodeDBMenu(); }; } // namespace graphics \ No newline at end of file