Adjustments for OLED on keeping menus tidy, added Bluetooth Toggle to Home frame. Also widen the frame slightly if you have a scroll bar

This commit is contained in:
Jason P 2025-06-27 23:43:01 -05:00
parent 8190211b90
commit 3a384255b0
2 changed files with 33 additions and 14 deletions

View File

@ -251,20 +251,22 @@ void menuHandler::homeBaseMenu()
if (kb_found) { if (kb_found) {
#ifdef PIN_EINK_EN #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 #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 #endif
optionsArrayPtr = optionsArray; optionsArrayPtr = optionsArray;
options = 5; 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 { screen->showOverlayBanner("Home Action", 30000, optionsArrayPtr, options, [](int selected) -> void {
if (selected == 1) { if (selected == 1) {
@ -283,7 +285,15 @@ void menuHandler::homeBaseMenu()
} else if (selected == 3) { } else if (selected == 3) {
cannedMessageModule->LaunchWithDestination(NODENUM_BROADCAST); cannedMessageModule->LaunchWithDestination(NODENUM_BROADCAST);
} else if (selected == 4) { } 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);
} }
}); });
} }

View File

@ -154,9 +154,15 @@ void NotificationRenderer::drawAlertBannerOverlay(OLEDDisplay *display, OLEDDisp
for (int i = firstOptionToShow; i < alertBannerOptions && linesShown < visibleTotalLines; i++, linesShown++) { for (int i = firstOptionToShow; i < alertBannerOptions && linesShown < visibleTotalLines; i++, linesShown++) {
if (i == curSelected) { if (i == curSelected) {
strncpy(lineBuffer, "> ", 3); if (isHighResolution) {
strncpy(lineBuffer + 2, optionsArrayPtr[i], 36); strncpy(lineBuffer, "> ", 3);
strncpy(lineBuffer + strlen(optionsArrayPtr[i]) + 2, " <", 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'; lineBuffer[39] = '\0';
linePointers[linesShown] = lineBuffer; linePointers[linesShown] = lineBuffer;
} else { } else {
@ -217,6 +223,9 @@ void NotificationRenderer::drawNotificationBox(OLEDDisplay *display, OLEDDisplay
uint16_t boxHeight = contentHeight + vPadding * 2; uint16_t boxHeight = contentHeight + vPadding * 2;
int16_t boxLeft = (display->width() / 2) - (boxWidth / 2); int16_t boxLeft = (display->width() / 2) - (boxWidth / 2);
if (totalLines > visibleTotalLines) {
boxWidth += (isHighResolution) ? 4 : 2;
}
int16_t boxTop = (display->height() / 2) - (boxHeight / 2); int16_t boxTop = (display->height() / 2) - (boxHeight / 2);
// === Draw Box === // === Draw Box ===