mirror of
https://github.com/meshtastic/firmware.git
synced 2025-07-31 02:45:41 +00:00
Dismissing more menus now available
This commit is contained in:
parent
42516f541e
commit
3d53ead901
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@ -10,5 +10,10 @@
|
|||||||
},
|
},
|
||||||
"[powershell]": {
|
"[powershell]": {
|
||||||
"editor.defaultFormatter": "ms-vscode.powershell"
|
"editor.defaultFormatter": "ms-vscode.powershell"
|
||||||
|
},
|
||||||
|
"files.associations": {
|
||||||
|
"deque": "cpp",
|
||||||
|
"string": "cpp",
|
||||||
|
"vector": "cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -891,44 +891,55 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
// Declare this early so it’s available in FOCUS_PRESERVE block
|
// Declare this early so it’s available in FOCUS_PRESERVE block
|
||||||
bool willInsertTextMessage = shouldDrawMessage(&devicestate.rx_text_message);
|
bool willInsertTextMessage = shouldDrawMessage(&devicestate.rx_text_message);
|
||||||
|
|
||||||
fsi.positions.home = numframes;
|
if (!dismissedFrames.home) {
|
||||||
normalFrames[numframes++] = graphics::UIRenderer::drawDeviceFocused;
|
fsi.positions.home = numframes;
|
||||||
indicatorIcons.push_back(icon_home);
|
normalFrames[numframes++] = graphics::UIRenderer::drawDeviceFocused;
|
||||||
|
indicatorIcons.push_back(icon_home);
|
||||||
|
}
|
||||||
|
|
||||||
fsi.positions.textMessage = numframes;
|
fsi.positions.textMessage = numframes;
|
||||||
normalFrames[numframes++] = graphics::MessageRenderer::drawTextMessageFrame;
|
normalFrames[numframes++] = graphics::MessageRenderer::drawTextMessageFrame;
|
||||||
indicatorIcons.push_back(icon_mail);
|
indicatorIcons.push_back(icon_mail);
|
||||||
|
|
||||||
#ifndef USE_EINK
|
#ifndef USE_EINK
|
||||||
fsi.positions.nodelist = numframes;
|
if (!dismissedFrames.nodelist) {
|
||||||
normalFrames[numframes++] = graphics::NodeListRenderer::drawDynamicNodeListScreen;
|
fsi.positions.nodelist = numframes;
|
||||||
indicatorIcons.push_back(icon_nodes);
|
normalFrames[numframes++] = graphics::NodeListRenderer::drawDynamicNodeListScreen;
|
||||||
|
indicatorIcons.push_back(icon_nodes);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Show detailed node views only on E-Ink builds
|
// Show detailed node views only on E-Ink builds
|
||||||
#ifdef USE_EINK
|
#ifdef USE_EINK
|
||||||
fsi.positions.nodelist_lastheard = numframes;
|
if (!dismissedFrames.nodelist_lastheard) {
|
||||||
normalFrames[numframes++] = graphics::NodeListRenderer::drawLastHeardScreen;
|
fsi.positions.nodelist_lastheard = numframes;
|
||||||
indicatorIcons.push_back(icon_nodes);
|
normalFrames[numframes++] = graphics::NodeListRenderer::drawLastHeardScreen;
|
||||||
|
indicatorIcons.push_back(icon_nodes);
|
||||||
fsi.positions.nodelist_hopsignal = numframes;
|
}
|
||||||
normalFrames[numframes++] = graphics::NodeListRenderer::drawHopSignalScreen;
|
if (!dismissedFrames.nodelist_hopsignal) {
|
||||||
indicatorIcons.push_back(icon_signal);
|
fsi.positions.nodelist_hopsignal = numframes;
|
||||||
|
normalFrames[numframes++] = graphics::NodeListRenderer::drawHopSignalScreen;
|
||||||
fsi.positions.nodelist_distance = numframes;
|
indicatorIcons.push_back(icon_signal);
|
||||||
normalFrames[numframes++] = graphics::NodeListRenderer::drawDistanceScreen;
|
}
|
||||||
indicatorIcons.push_back(icon_distance);
|
if (!dismissedFrames.nodelist_distance) {
|
||||||
|
fsi.positions.nodelist_distance = numframes;
|
||||||
|
normalFrames[numframes++] = graphics::NodeListRenderer::drawDistanceScreen;
|
||||||
|
indicatorIcons.push_back(icon_distance);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_GPS
|
#if HAS_GPS
|
||||||
fsi.positions.nodelist_bearings = numframes;
|
if (!dismissedFrames.nodelist_bearings) {
|
||||||
normalFrames[numframes++] = graphics::NodeListRenderer::drawNodeListWithCompasses;
|
fsi.positions.nodelist_bearings = numframes;
|
||||||
indicatorIcons.push_back(icon_list);
|
normalFrames[numframes++] = graphics::NodeListRenderer::drawNodeListWithCompasses;
|
||||||
|
indicatorIcons.push_back(icon_list);
|
||||||
fsi.positions.gps = numframes;
|
}
|
||||||
normalFrames[numframes++] = graphics::UIRenderer::drawCompassAndLocationScreen;
|
if (!dismissedFrames.gps) {
|
||||||
indicatorIcons.push_back(icon_compass);
|
fsi.positions.gps = numframes;
|
||||||
|
normalFrames[numframes++] = graphics::UIRenderer::drawCompassAndLocationScreen;
|
||||||
|
indicatorIcons.push_back(icon_compass);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (RadioLibInterface::instance) {
|
if (RadioLibInterface::instance && !dismissedFrames.lora) {
|
||||||
fsi.positions.lora = numframes;
|
fsi.positions.lora = numframes;
|
||||||
normalFrames[numframes++] = graphics::DebugRenderer::drawLoRaFocused;
|
normalFrames[numframes++] = graphics::DebugRenderer::drawLoRaFocused;
|
||||||
indicatorIcons.push_back(icon_radio);
|
indicatorIcons.push_back(icon_radio);
|
||||||
@ -1100,6 +1111,10 @@ void Screen::dismissCurrentFrame()
|
|||||||
LOG_INFO("Dismiss Memory");
|
LOG_INFO("Dismiss Memory");
|
||||||
dismissedFrames.system = true;
|
dismissedFrames.system = true;
|
||||||
dismissed = true;
|
dismissed = true;
|
||||||
|
} else if (currentFrame == framesetInfo.positions.nodelist_bearings) {
|
||||||
|
LOG_INFO("Dismiss Bearings");
|
||||||
|
dismissedFrames.nodelist_bearings = true;
|
||||||
|
dismissed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dismissed) {
|
if (dismissed) {
|
||||||
|
@ -676,6 +676,20 @@ class Screen : public concurrency::OSThread
|
|||||||
bool waypoint = false;
|
bool waypoint = false;
|
||||||
bool wifi = false;
|
bool wifi = false;
|
||||||
bool system = false;
|
bool system = false;
|
||||||
|
bool home = false;
|
||||||
|
#ifndef USE_EINK
|
||||||
|
bool nodelist = false;
|
||||||
|
#endif
|
||||||
|
#ifdef USE_EINK
|
||||||
|
bool nodelist_lastheard = false;
|
||||||
|
bool nodelist_hopsignal = false;
|
||||||
|
bool nodelist_distance = false;
|
||||||
|
#endif
|
||||||
|
#if HAS_GPS
|
||||||
|
bool nodelist_bearings = false;
|
||||||
|
bool gps = false;
|
||||||
|
#endif
|
||||||
|
bool lora = false;
|
||||||
} dismissedFrames;
|
} dismissedFrames;
|
||||||
|
|
||||||
/// Try to start drawing ASAP
|
/// Try to start drawing ASAP
|
||||||
|
@ -464,7 +464,7 @@ void menuHandler::favoriteBaseMenu()
|
|||||||
|
|
||||||
void menuHandler::positionBaseMenu()
|
void menuHandler::positionBaseMenu()
|
||||||
{
|
{
|
||||||
enum optionsNumbers { Back, GPSToggle, CompassMenu, CompassCalibrate, enumEnd };
|
enum optionsNumbers { Back, GPSToggle, CompassMenu, CompassCalibrate, DismissFrame, enumEnd };
|
||||||
|
|
||||||
static const char *optionsArray[enumEnd] = {"Back", "GPS Toggle", "Compass"};
|
static const char *optionsArray[enumEnd] = {"Back", "GPS Toggle", "Compass"};
|
||||||
static int optionsEnumArray[enumEnd] = {Back, GPSToggle, CompassMenu};
|
static int optionsEnumArray[enumEnd] = {Back, GPSToggle, CompassMenu};
|
||||||
@ -488,6 +488,9 @@ void menuHandler::positionBaseMenu()
|
|||||||
screen->runNow();
|
screen->runNow();
|
||||||
} else if (selected == CompassCalibrate) {
|
} else if (selected == CompassCalibrate) {
|
||||||
accelerometerThread->calibrate(30);
|
accelerometerThread->calibrate(30);
|
||||||
|
} else if (selected == DismissFrame) {
|
||||||
|
menuQueue = DismissPositionFrame;
|
||||||
|
screen->runNow();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
screen->showOverlayBanner(bannerOptions);
|
screen->showOverlayBanner(bannerOptions);
|
||||||
@ -495,12 +498,12 @@ void menuHandler::positionBaseMenu()
|
|||||||
|
|
||||||
void menuHandler::nodeListMenu()
|
void menuHandler::nodeListMenu()
|
||||||
{
|
{
|
||||||
enum optionsNumbers { Back, Favorite, Verify, Reset };
|
enum optionsNumbers { Back, Favorite, Verify, Reset, Dismissnodelist_bearings };
|
||||||
static const char *optionsArray[] = {"Back", "Add Favorite", "Key Verification", "Reset NodeDB"};
|
static const char *optionsArray[] = {"Back", "Add Favorite", "Key Verification", "Reset NodeDB", "Dismiss Frame"};
|
||||||
BannerOverlayOptions bannerOptions;
|
BannerOverlayOptions bannerOptions;
|
||||||
bannerOptions.message = "Node Action";
|
bannerOptions.message = "Node Action";
|
||||||
bannerOptions.optionsArrayPtr = optionsArray;
|
bannerOptions.optionsArrayPtr = optionsArray;
|
||||||
bannerOptions.optionsCount = 4;
|
bannerOptions.optionsCount = 5;
|
||||||
bannerOptions.bannerCallback = [](int selected) -> void {
|
bannerOptions.bannerCallback = [](int selected) -> void {
|
||||||
if (selected == Favorite) {
|
if (selected == Favorite) {
|
||||||
menuQueue = add_favorite;
|
menuQueue = add_favorite;
|
||||||
@ -511,6 +514,9 @@ void menuHandler::nodeListMenu()
|
|||||||
} else if (selected == Reset) {
|
} else if (selected == Reset) {
|
||||||
menuQueue = reset_node_db_menu;
|
menuQueue = reset_node_db_menu;
|
||||||
screen->runNow();
|
screen->runNow();
|
||||||
|
} else if (selected == Dismissnodelist_bearings) {
|
||||||
|
menuQueue = Dismissnodelist_bearingsFrame;
|
||||||
|
screen->runNow();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
screen->showOverlayBanner(bannerOptions);
|
screen->showOverlayBanner(bannerOptions);
|
||||||
@ -1091,6 +1097,60 @@ void menuHandler::DismissSystemFrame_menu()
|
|||||||
screen->showOverlayBanner(bannerOptions);
|
screen->showOverlayBanner(bannerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void menuHandler::Dismissnodelist_bearings_menu()
|
||||||
|
{
|
||||||
|
static const char *optionsArray[] = {"Back", "Confirm"};
|
||||||
|
BannerOverlayOptions bannerOptions;
|
||||||
|
bannerOptions.message = "Dismiss Bearings Frame?";
|
||||||
|
bannerOptions.optionsArrayPtr = optionsArray;
|
||||||
|
bannerOptions.optionsCount = 2;
|
||||||
|
bannerOptions.bannerCallback = [](int selected) -> void {
|
||||||
|
if (selected == 1) {
|
||||||
|
screen->dismissCurrentFrame();
|
||||||
|
} else {
|
||||||
|
// menuQueue = system_base_menu;
|
||||||
|
// screen->runNow();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
screen->showOverlayBanner(bannerOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
void menuHandler::DismissLoRaFrame_menu()
|
||||||
|
{
|
||||||
|
static const char *optionsArray[] = {"Back", "Confirm"};
|
||||||
|
BannerOverlayOptions bannerOptions;
|
||||||
|
bannerOptions.message = "Dismiss LoRa Frame?";
|
||||||
|
bannerOptions.optionsArrayPtr = optionsArray;
|
||||||
|
bannerOptions.optionsCount = 2;
|
||||||
|
bannerOptions.bannerCallback = [](int selected) -> void {
|
||||||
|
if (selected == 1) {
|
||||||
|
screen->dismissCurrentFrame();
|
||||||
|
} else {
|
||||||
|
// menuQueue = system_base_menu;
|
||||||
|
// screen->runNow();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
screen->showOverlayBanner(bannerOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
void menuHandler::DismissPositionFrame_menu()
|
||||||
|
{
|
||||||
|
static const char *optionsArray[] = {"Back", "Confirm"};
|
||||||
|
BannerOverlayOptions bannerOptions;
|
||||||
|
bannerOptions.message = "Dismiss Position Frame?";
|
||||||
|
bannerOptions.optionsArrayPtr = optionsArray;
|
||||||
|
bannerOptions.optionsCount = 2;
|
||||||
|
bannerOptions.bannerCallback = [](int selected) -> void {
|
||||||
|
if (selected == 1) {
|
||||||
|
screen->dismissCurrentFrame();
|
||||||
|
} else {
|
||||||
|
menuQueue = position_base_menu;
|
||||||
|
screen->runNow();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
screen->showOverlayBanner(bannerOptions);
|
||||||
|
}
|
||||||
|
|
||||||
void menuHandler::handleMenuSwitch(OLEDDisplay *display)
|
void menuHandler::handleMenuSwitch(OLEDDisplay *display)
|
||||||
{
|
{
|
||||||
if (menuQueue != menu_none)
|
if (menuQueue != menu_none)
|
||||||
@ -1184,6 +1244,15 @@ void menuHandler::handleMenuSwitch(OLEDDisplay *display)
|
|||||||
case DismissSystemFrame:
|
case DismissSystemFrame:
|
||||||
DismissSystemFrame_menu();
|
DismissSystemFrame_menu();
|
||||||
break;
|
break;
|
||||||
|
case DismissLoRaFrame:
|
||||||
|
DismissLoRaFrame_menu();
|
||||||
|
break;
|
||||||
|
case Dismissnodelist_bearingsFrame:
|
||||||
|
Dismissnodelist_bearings_menu();
|
||||||
|
break;
|
||||||
|
case DismissPositionFrame:
|
||||||
|
DismissPositionFrame_menu();
|
||||||
|
break;
|
||||||
case throttle_message:
|
case throttle_message:
|
||||||
screen->showSimpleBanner("Too Many Attempts\nTry again in 60 seconds.", 5000);
|
screen->showSimpleBanner("Too Many Attempts\nTry again in 60 seconds.", 5000);
|
||||||
break;
|
break;
|
||||||
|
@ -37,7 +37,10 @@ class menuHandler
|
|||||||
key_verification_init,
|
key_verification_init,
|
||||||
key_verification_final_prompt,
|
key_verification_final_prompt,
|
||||||
throttle_message,
|
throttle_message,
|
||||||
DismissSystemFrame
|
DismissSystemFrame,
|
||||||
|
DismissLoRaFrame,
|
||||||
|
Dismissnodelist_bearingsFrame,
|
||||||
|
DismissPositionFrame
|
||||||
};
|
};
|
||||||
static screenMenus menuQueue;
|
static screenMenus menuQueue;
|
||||||
|
|
||||||
@ -73,6 +76,9 @@ class menuHandler
|
|||||||
static void screenOptionsMenu();
|
static void screenOptionsMenu();
|
||||||
static void powerMenu();
|
static void powerMenu();
|
||||||
static void DismissSystemFrame_menu();
|
static void DismissSystemFrame_menu();
|
||||||
|
static void Dismissnodelist_bearings_menu();
|
||||||
|
static void DismissLoRaFrame_menu();
|
||||||
|
static void DismissPositionFrame_menu();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void saveUIConfig();
|
static void saveUIConfig();
|
||||||
|
Loading…
Reference in New Issue
Block a user