Plumb in the digital/analog picker

This commit is contained in:
Jason P 2025-06-23 11:41:34 -05:00
parent 99176a8388
commit 7f8acf5658
3 changed files with 31 additions and 7 deletions

View File

@ -861,13 +861,11 @@ void Screen::setFrames(FrameFocus focus)
indicatorIcons.push_back(icon_memory); indicatorIcons.push_back(icon_memory);
} }
#if !defined(DISPLAY_CLOCK_FRAME) #if !defined(DISPLAY_CLOCK_FRAME)
LOG_INFO("Current state of graphics::ClockRenderer::digitalWatchFace is %s", graphics::ClockRenderer::digitalWatchFace);
fsi.positions.clock = numframes; 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); indicatorIcons.push_back(digital_icon_clock);
fsi.positions.clock = numframes;
normalFrames[numframes++] = graphics::ClockRenderer::drawAnalogClockFrame;
indicatorIcons.push_back(analog_icon_clock);
#endif #endif
// We don't show the node info of our node (if we have it yet - we should) // We don't show the node info of our node (if we have it yet - we should)

View File

@ -1,5 +1,6 @@
#include "configuration.h" #include "configuration.h"
#if HAS_SCREEN #if HAS_SCREEN
#include "ClockRenderer.h"
#include "MenuHandler.h" #include "MenuHandler.h"
#include "MeshRadio.h" #include "MeshRadio.h"
#include "MeshService.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() void menuHandler::TZPicker()
{ {
static const char *optionsArray[] = {"Back", static const char *optionsArray[] = {"Back",
@ -156,9 +174,13 @@ void menuHandler::TZPicker()
void menuHandler::clockMenu() 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 { screen->showOverlayBanner("Clock Menu", 30000, optionsArray, 3, [](int selected) -> void {
if (selected == 1) { if (selected == 1) {
menuHandler::menuQueue = menuHandler::clock_face_picker;
screen->setInterval(0);
runASAP = true;
} else if (selected == 1) {
menuHandler::menuQueue = menuHandler::twelve_hour_picker; menuHandler::menuQueue = menuHandler::twelve_hour_picker;
screen->setInterval(0); screen->setInterval(0);
runASAP = true; runASAP = true;
@ -230,6 +252,9 @@ void menuHandler::handleMenuSwitch()
case twelve_hour_picker: case twelve_hour_picker:
TwelveHourPicker(); TwelveHourPicker();
break; break;
case clock_face_picker:
ClockFacePicker();
break;
case clock_menu: case clock_menu:
clockMenu(); clockMenu();
break; break;

View File

@ -5,7 +5,7 @@ namespace graphics
class menuHandler class menuHandler
{ {
public: 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 screenMenus menuQueue;
static void LoraRegionPicker(uint32_t duration = 30000); static void LoraRegionPicker(uint32_t duration = 30000);
@ -13,6 +13,7 @@ class menuHandler
static void clockMenu(); static void clockMenu();
static void TZPicker(); static void TZPicker();
static void TwelveHourPicker(); static void TwelveHourPicker();
static void ClockFacePicker();
static void messageResponseMenu(); static void messageResponseMenu();
}; };