diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index c5e6d4f4d..6a691967d 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -1160,6 +1160,30 @@ void Screen::dismissCurrentFrame() } } +void Screen::restoreAllFrames() +{ + dismissedFrames.textMessage = false; + dismissedFrames.waypoint = false; + dismissedFrames.wifi = false; + dismissedFrames.system = false; + dismissedFrames.home = false; + dismissedFrames.clock = false; +#ifndef USE_EINK + dismissedFrames.nodelist = false; +#endif +#ifdef USE_EINK + dismissedFrames.nodelist_lastheard = false; + dismissedFrames.nodelist_hopsignal = false; + dismissedFrames.nodelist_distance = false; +#endif +#if HAS_GPS + dismissedFrames.nodelist_bearings = false; + dismissedFrames.gps = false; +#endif + dismissedFrames.lora = false; + setFrames(FOCUS_DEFAULT); +} + void Screen::handleStartFirmwareUpdateScreen() { LOG_DEBUG("Show firmware screen"); diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index a3a7fd446..4bf2fc4e6 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -593,6 +593,9 @@ class Screen : public concurrency::OSThread // Dismiss the currently focussed frame, if possible (e.g. text message, waypoint) void dismissCurrentFrame(); + // Restore all Frames + void restoreAllFrames(); + #ifdef USE_EINK /// Draw an image to remain on E-Ink display after screen off void setScreensaverFrames(FrameCallback einkScreensaver = NULL); diff --git a/src/graphics/draw/MenuHandler.cpp b/src/graphics/draw/MenuHandler.cpp index fa012bdb1..d0b67f1ec 100644 --- a/src/graphics/draw/MenuHandler.cpp +++ b/src/graphics/draw/MenuHandler.cpp @@ -396,7 +396,7 @@ void menuHandler::textMessageBaseMenu() void menuHandler::systemBaseMenu() { - enum optionsNumbers { Back, Notifications, ScreenOptions, PowerMenu, Test, DismissFrame, enumEnd }; + enum optionsNumbers { Back, Notifications, ScreenOptions, PowerMenu, RestoreAllFrames, Test, DismissFrame, enumEnd }; static const char *optionsArray[enumEnd] = {"Back"}; static int optionsEnumArray[enumEnd] = {Back}; int options = 1; @@ -409,6 +409,9 @@ void menuHandler::systemBaseMenu() optionsEnumArray[options++] = ScreenOptions; #endif + optionsArray[options] = "Restore All Frames"; + optionsEnumArray[options++] = RestoreAllFrames; + optionsArray[options] = "Reboot/Shutdown"; optionsEnumArray[options++] = PowerMenu; @@ -435,6 +438,9 @@ void menuHandler::systemBaseMenu() } else if (selected == PowerMenu) { menuHandler::menuQueue = menuHandler::power_menu; screen->runNow(); + } else if (selected == RestoreAllFrames) { + menuHandler::menuQueue = menuHandler::RestoreAllFrames; + screen->runNow(); } else if (selected == Test) { menuHandler::menuQueue = menuHandler::test_menu; screen->runNow(); @@ -1115,6 +1121,21 @@ void menuHandler::DismissCurrentFrame_menu() screen->showOverlayBanner(bannerOptions); } +void menuHandler::RestoreAllFrames_menu() +{ + static const char *optionsArray[] = {"Cancel", "Confirm"}; + BannerOverlayOptions bannerOptions; + bannerOptions.message = "Restore All Frames?"; + bannerOptions.optionsArrayPtr = optionsArray; + bannerOptions.optionsCount = 2; + bannerOptions.bannerCallback = [](int selected) -> void { + if (selected == 1) { + screen->restoreAllFrames(); + } + }; + screen->showOverlayBanner(bannerOptions); +} + void menuHandler::handleMenuSwitch(OLEDDisplay *display) { if (menuQueue != menu_none) @@ -1208,6 +1229,9 @@ void menuHandler::handleMenuSwitch(OLEDDisplay *display) case DismissCurrentFrame: DismissCurrentFrame_menu(); break; + case RestoreAllFrames: + RestoreAllFrames_menu(); + break; case throttle_message: screen->showSimpleBanner("Too Many Attempts\nTry again in 60 seconds.", 5000); break; diff --git a/src/graphics/draw/MenuHandler.h b/src/graphics/draw/MenuHandler.h index b40d0b1cf..3e4779d52 100644 --- a/src/graphics/draw/MenuHandler.h +++ b/src/graphics/draw/MenuHandler.h @@ -37,7 +37,8 @@ class menuHandler key_verification_init, key_verification_final_prompt, throttle_message, - DismissCurrentFrame + DismissCurrentFrame, + RestoreAllFrames }; static screenMenus menuQueue; @@ -74,6 +75,7 @@ class menuHandler static void screenOptionsMenu(); static void powerMenu(); static void DismissCurrentFrame_menu(); + static void RestoreAllFrames_menu(); private: static void saveUIConfig();