mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-13 16:55:08 +00:00
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:
parent
8190211b90
commit
3a384255b0
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -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 ===
|
||||
|
Loading…
Reference in New Issue
Block a user