Fix highlighted buttons with touch screens

This commit is contained in:
Just Call Me Koko
2024-12-15 00:05:35 -05:00
parent 8ea2604761
commit 362189ed78
2 changed files with 32 additions and 27 deletions

View File

@@ -587,26 +587,28 @@ void MenuFunctions::buttonNotSelected(uint8_t b, int8_t x) {
} }
void MenuFunctions::buttonSelected(uint8_t b, int8_t x) { void MenuFunctions::buttonSelected(uint8_t b, int8_t x) {
if (x == -1) #ifndef HAS_ILI9341
x = b; if (x == -1)
x = b;
#ifdef HAS_MINI_SCREEN #ifdef HAS_MINI_SCREEN
display_obj.tft.setFreeFont(NULL); display_obj.tft.setFreeFont(NULL);
display_obj.key[b].drawButton(true, current_menu->list->get(x).name); display_obj.key[b].drawButton(true, current_menu->list->get(x).name);
#endif #endif
#ifdef HAS_FULL_SCREEN #ifdef HAS_FULL_SCREEN
display_obj.tft.setFreeFont(MENU_FONT); display_obj.tft.setFreeFont(MENU_FONT);
display_obj.key[b].drawButton(true, current_menu->list->get(x).name); display_obj.key[b].drawButton(true, current_menu->list->get(x).name);
if (current_menu->list->get(x).name != text09) if (current_menu->list->get(x).name != text09)
display_obj.tft.drawXBitmap(0, display_obj.tft.drawXBitmap(0,
KEY_Y + x * (KEY_H + KEY_SPACING_Y) - (ICON_H / 2), KEY_Y + x * (KEY_H + KEY_SPACING_Y) - (ICON_H / 2),
menu_icons[current_menu->list->get(x).icon], menu_icons[current_menu->list->get(x).icon],
ICON_W, ICON_W,
ICON_H, ICON_H,
TFT_BLACK, TFT_BLACK,
current_menu->list->get(x).color); current_menu->list->get(x).color);
display_obj.tft.setFreeFont(NULL); display_obj.tft.setFreeFont(NULL);
#endif
#endif #endif
} }
@@ -2626,13 +2628,16 @@ void MenuFunctions::displayCurrentMenu(uint8_t start_index)
for (uint8_t i = start_index; i < current_menu->list->size(); i++) for (uint8_t i = start_index; i < current_menu->list->size(); i++)
{ {
#ifdef HAS_FULL_SCREEN #ifdef HAS_FULL_SCREEN
if ((current_menu->list->get(i).selected) || (current_menu->selected == i)) { #ifndef HAS_ILI9341
Serial.println("Selected button: " + (String)current_menu->list->get(i).name); if ((current_menu->list->get(i).selected) || (current_menu->selected == i)) {
display_obj.key[i].drawButton(true, current_menu->list->get(i).name); display_obj.key[i].drawButton(true, current_menu->list->get(i).name);
} }
else { else {
display_obj.key[i].drawButton(false, current_menu->list->get(i).name); display_obj.key[i].drawButton(false, current_menu->list->get(i).name);
} }
#else
display_obj.key[i].drawButton(false, current_menu->list->get(i).name);
#endif
if (current_menu->list->get(i).name != text09) if (current_menu->list->get(i).name != text09)
display_obj.tft.drawXBitmap(0, display_obj.tft.drawXBitmap(0,

View File

@@ -11,11 +11,11 @@
//#define MARAUDER_MINI //#define MARAUDER_MINI
//#define MARAUDER_V4 //#define MARAUDER_V4
//#define MARAUDER_V6 //#define MARAUDER_V6
//#define MARAUDER_V6_1 #define MARAUDER_V6_1
//#define MARAUDER_V7 //#define MARAUDER_V7
//#define MARAUDER_KIT //#define MARAUDER_KIT
//#define GENERIC_ESP32 //#define GENERIC_ESP32
#define MARAUDER_FLIPPER //#define MARAUDER_FLIPPER
//#define ESP32_LDDB //#define ESP32_LDDB
//#define MARAUDER_DEV_BOARD_PRO //#define MARAUDER_DEV_BOARD_PRO
//#define XIAO_ESP32_S3 //#define XIAO_ESP32_S3