Skip to content

Commit

Permalink
Fix highlighted buttons with touch screens
Browse files Browse the repository at this point in the history
  • Loading branch information
justcallmekoko committed Dec 15, 2024
1 parent 8ea2604 commit 362189e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 27 deletions.
55 changes: 30 additions & 25 deletions esp32_marauder/MenuFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,26 +587,28 @@ void MenuFunctions::buttonNotSelected(uint8_t b, int8_t x) {
}

void MenuFunctions::buttonSelected(uint8_t b, int8_t x) {
if (x == -1)
x = b;
#ifndef HAS_ILI9341
if (x == -1)
x = b;

#ifdef HAS_MINI_SCREEN
display_obj.tft.setFreeFont(NULL);
display_obj.key[b].drawButton(true, current_menu->list->get(x).name);
#endif
#ifdef HAS_MINI_SCREEN
display_obj.tft.setFreeFont(NULL);
display_obj.key[b].drawButton(true, current_menu->list->get(x).name);
#endif

#ifdef HAS_FULL_SCREEN
display_obj.tft.setFreeFont(MENU_FONT);
display_obj.key[b].drawButton(true, current_menu->list->get(x).name);
if (current_menu->list->get(x).name != text09)
display_obj.tft.drawXBitmap(0,
KEY_Y + x * (KEY_H + KEY_SPACING_Y) - (ICON_H / 2),
menu_icons[current_menu->list->get(x).icon],
ICON_W,
ICON_H,
TFT_BLACK,
current_menu->list->get(x).color);
display_obj.tft.setFreeFont(NULL);
#ifdef HAS_FULL_SCREEN
display_obj.tft.setFreeFont(MENU_FONT);
display_obj.key[b].drawButton(true, current_menu->list->get(x).name);
if (current_menu->list->get(x).name != text09)
display_obj.tft.drawXBitmap(0,
KEY_Y + x * (KEY_H + KEY_SPACING_Y) - (ICON_H / 2),
menu_icons[current_menu->list->get(x).icon],
ICON_W,
ICON_H,
TFT_BLACK,
current_menu->list->get(x).color);
display_obj.tft.setFreeFont(NULL);
#endif
#endif
}

Expand Down Expand Up @@ -2626,13 +2628,16 @@ void MenuFunctions::displayCurrentMenu(uint8_t start_index)
for (uint8_t i = start_index; i < current_menu->list->size(); i++)
{
#ifdef HAS_FULL_SCREEN
if ((current_menu->list->get(i).selected) || (current_menu->selected == i)) {
Serial.println("Selected button: " + (String)current_menu->list->get(i).name);
display_obj.key[i].drawButton(true, current_menu->list->get(i).name);
}
else {
display_obj.key[i].drawButton(false, current_menu->list->get(i).name);
}
#ifndef HAS_ILI9341
if ((current_menu->list->get(i).selected) || (current_menu->selected == i)) {
display_obj.key[i].drawButton(true, current_menu->list->get(i).name);
}
else {
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)
display_obj.tft.drawXBitmap(0,
Expand Down
4 changes: 2 additions & 2 deletions esp32_marauder/configs.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
//#define MARAUDER_MINI
//#define MARAUDER_V4
//#define MARAUDER_V6
//#define MARAUDER_V6_1
#define MARAUDER_V6_1
//#define MARAUDER_V7
//#define MARAUDER_KIT
//#define GENERIC_ESP32
#define MARAUDER_FLIPPER
//#define MARAUDER_FLIPPER
//#define ESP32_LDDB
//#define MARAUDER_DEV_BOARD_PRO
//#define XIAO_ESP32_S3
Expand Down

0 comments on commit 362189e

Please sign in to comment.