diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index f94a8d991..55733deb4 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -861,13 +861,11 @@ void Screen::setFrames(FrameFocus focus) indicatorIcons.push_back(icon_memory); } #if !defined(DISPLAY_CLOCK_FRAME) + LOG_INFO("Current state of graphics::ClockRenderer::digitalWatchFace is %s", graphics::ClockRenderer::digitalWatchFace); fsi.positions.clock = numframes; - normalFrames[numframes++] = graphics::ClockRenderer::drawDigitalClockFrame; + normalFrames[numframes++] = graphics::ClockRenderer::digitalWatchFace ? graphics::ClockRenderer::drawDigitalClockFrame + : &graphics::ClockRenderer::drawAnalogClockFrame; indicatorIcons.push_back(digital_icon_clock); - - fsi.positions.clock = numframes; - normalFrames[numframes++] = graphics::ClockRenderer::drawAnalogClockFrame; - indicatorIcons.push_back(analog_icon_clock); #endif // We don't show the node info of our node (if we have it yet - we should) diff --git a/src/graphics/draw/MenuHandler.cpp b/src/graphics/draw/MenuHandler.cpp index c68ebfcc2..5ee1a0259 100644 --- a/src/graphics/draw/MenuHandler.cpp +++ b/src/graphics/draw/MenuHandler.cpp @@ -1,5 +1,6 @@ #include "configuration.h" #if HAS_SCREEN +#include "ClockRenderer.h" #include "MenuHandler.h" #include "MeshRadio.h" #include "MeshService.h" @@ -91,6 +92,23 @@ void menuHandler::TwelveHourPicker() }); } +void menuHandler::ClockFacePicker() +{ + static const char *optionsArray[] = {"Back", "Digital", "Analog"}; + screen->showOverlayBanner("12/24 display?", 30000, optionsArray, 3, [](int selected) -> void { + if (selected == 0) { + menuHandler::menuQueue = menuHandler::clock_menu; + } else if (selected == 1) { + graphics::ClockRenderer::digitalWatchFace = true; + screen->setFrames(); // Causes the screens to redraw, but doesn't change the face + } else { + graphics::ClockRenderer::digitalWatchFace = false; + screen->setFrames(); // Causes the screens to redraw, but doesn't change the face + } + service->reloadConfig(SEGMENT_CONFIG); + }); +} + void menuHandler::TZPicker() { static const char *optionsArray[] = {"Back", @@ -156,9 +174,13 @@ void menuHandler::TZPicker() void menuHandler::clockMenu() { - static const char *optionsArray[] = {"Back", "12-hour", "Timezone"}; + static const char *optionsArray[] = {"Back", "Clock Face", "12-hour", "Timezone"}; screen->showOverlayBanner("Clock Menu", 30000, optionsArray, 3, [](int selected) -> void { if (selected == 1) { + menuHandler::menuQueue = menuHandler::clock_face_picker; + screen->setInterval(0); + runASAP = true; + } else if (selected == 1) { menuHandler::menuQueue = menuHandler::twelve_hour_picker; screen->setInterval(0); runASAP = true; @@ -230,6 +252,9 @@ void menuHandler::handleMenuSwitch() case twelve_hour_picker: TwelveHourPicker(); break; + case clock_face_picker: + ClockFacePicker(); + break; case clock_menu: clockMenu(); break; diff --git a/src/graphics/draw/MenuHandler.h b/src/graphics/draw/MenuHandler.h index a4c9d6fe6..f228c238b 100644 --- a/src/graphics/draw/MenuHandler.h +++ b/src/graphics/draw/MenuHandler.h @@ -5,7 +5,7 @@ namespace graphics class menuHandler { public: - enum screenMenus { menu_none, lora_picker, TZ_picker, twelve_hour_picker, clock_menu }; + enum screenMenus { menu_none, lora_picker, TZ_picker, twelve_hour_picker, clock_face_picker, clock_menu }; static screenMenus menuQueue; static void LoraRegionPicker(uint32_t duration = 30000); @@ -13,6 +13,7 @@ class menuHandler static void clockMenu(); static void TZPicker(); static void TwelveHourPicker(); + static void ClockFacePicker(); static void messageResponseMenu(); };