mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-03 04:15:53 +00:00
Establish Action Menu on all node list screens, add NodeDB reset (with confirmation) option
This commit is contained in:
parent
9f53df4f2e
commit
7af31a88c0
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user