From 3a384255b07c5846953799af465637483ea7b504 Mon Sep 17 00:00:00 2001 From: Jason P Date: Fri, 27 Jun 2025 23:43:01 -0500 Subject: [PATCH] Adjustments for OLED on keeping menus tidy, added Bluetooth Toggle to Home frame. Also widen the frame slightly if you have a scroll bar --- src/graphics/draw/MenuHandler.cpp | 32 ++++++++++++++-------- src/graphics/draw/NotificationRenderer.cpp | 15 ++++++++-- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/graphics/draw/MenuHandler.cpp b/src/graphics/draw/MenuHandler.cpp index 1c327117e..11df0837d 100644 --- a/src/graphics/draw/MenuHandler.cpp +++ b/src/graphics/draw/MenuHandler.cpp @@ -251,20 +251,22 @@ void menuHandler::homeBaseMenu() if (kb_found) { #ifdef PIN_EINK_EN - static const char *optionsArray[] = {"Back", "Toggle Backlight", "Send Position", "New Preset Msg", "New Freetext Msg"}; + static const char *optionsArray[] = {"Back", "Toggle Backlight", "Send Position", + "New Preset Msg", "New Freetext Msg", "Bluetooth Toggle"}; #else - static const char *optionsArray[] = {"Back", "Sleep Screen", "Send Position", "New Preset Msg", "New Freetext Msg"}; + static const char *optionsArray[] = {"Back", "Sleep Screen", "Send Position", + "New Preset Msg", "New Freetext Msg", "Bluetooth Toggle"}; +#endif + optionsArrayPtr = optionsArray; + options = 6; + } else { +#ifdef PIN_EINK_EN + static const char *optionsArray[] = {"Back", "Toggle Backlight", "Send Position", "New Preset Msg", "Bluetooth Toggle"}; +#else + static const char *optionsArray[] = {"Back", "Sleep Screen", "Send Position", "New Preset Msg", "Bluetooth Toggle"}; #endif optionsArrayPtr = optionsArray; options = 5; - } else { -#ifdef PIN_EINK_EN - static const char *optionsArray[] = {"Back", "Toggle Backlight", "Send Position", "New Preset Msg"}; -#else - static const char *optionsArray[] = {"Back", "Sleep Screen", "Send Position", "New Preset Msg"}; -#endif - optionsArrayPtr = optionsArray; - options = 4; } screen->showOverlayBanner("Home Action", 30000, optionsArrayPtr, options, [](int selected) -> void { if (selected == 1) { @@ -283,7 +285,15 @@ void menuHandler::homeBaseMenu() } else if (selected == 3) { cannedMessageModule->LaunchWithDestination(NODENUM_BROADCAST); } else if (selected == 4) { - cannedMessageModule->LaunchFreetextWithDestination(NODENUM_BROADCAST); + if (kb_found) { + cannedMessageModule->LaunchFreetextWithDestination(NODENUM_BROADCAST); + } else { + InputEvent event = {.inputEvent = (input_broker_event)170, .kbchar = 170, .touchX = 0, .touchY = 0}; + inputBroker->injectInputEvent(&event); + } + } else if (selected == 5) { + InputEvent event = {.inputEvent = (input_broker_event)170, .kbchar = 170, .touchX = 0, .touchY = 0}; + inputBroker->injectInputEvent(&event); } }); } diff --git a/src/graphics/draw/NotificationRenderer.cpp b/src/graphics/draw/NotificationRenderer.cpp index 995dea318..7b7cd6557 100644 --- a/src/graphics/draw/NotificationRenderer.cpp +++ b/src/graphics/draw/NotificationRenderer.cpp @@ -154,9 +154,15 @@ void NotificationRenderer::drawAlertBannerOverlay(OLEDDisplay *display, OLEDDisp for (int i = firstOptionToShow; i < alertBannerOptions && linesShown < visibleTotalLines; i++, linesShown++) { if (i == curSelected) { - strncpy(lineBuffer, "> ", 3); - strncpy(lineBuffer + 2, optionsArrayPtr[i], 36); - strncpy(lineBuffer + strlen(optionsArrayPtr[i]) + 2, " <", 3); + if (isHighResolution) { + strncpy(lineBuffer, "> ", 3); + strncpy(lineBuffer + 2, optionsArrayPtr[i], 36); + strncpy(lineBuffer + strlen(optionsArrayPtr[i]) + 2, " <", 3); + } else { + strncpy(lineBuffer, ">", 2); + strncpy(lineBuffer + 1, optionsArrayPtr[i], 37); + strncpy(lineBuffer + strlen(optionsArrayPtr[i]) + 1, "<", 2); + } lineBuffer[39] = '\0'; linePointers[linesShown] = lineBuffer; } else { @@ -217,6 +223,9 @@ void NotificationRenderer::drawNotificationBox(OLEDDisplay *display, OLEDDisplay uint16_t boxHeight = contentHeight + vPadding * 2; int16_t boxLeft = (display->width() / 2) - (boxWidth / 2); + if (totalLines > visibleTotalLines) { + boxWidth += (isHighResolution) ? 4 : 2; + } int16_t boxTop = (display->height() / 2) - (boxHeight / 2); // === Draw Box ===