From c27d84893b25e75ba0c069d014f2051bdcf4cdd7 Mon Sep 17 00:00:00 2001 From: philmoz Date: Wed, 27 Sep 2023 13:05:13 +1000 Subject: [PATCH] Only show 'Invert' button on touch-screen radios. --- radio/src/gui/colorlcd/sourcechoice.cpp | 7 ++++--- radio/src/gui/colorlcd/switchchoice.cpp | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/radio/src/gui/colorlcd/sourcechoice.cpp b/radio/src/gui/colorlcd/sourcechoice.cpp index 7fd7b5a5bc7..b46e4c9a5c2 100644 --- a/radio/src/gui/colorlcd/sourcechoice.cpp +++ b/radio/src/gui/colorlcd/sourcechoice.cpp @@ -31,9 +31,9 @@ #include "switches.h" #if LCD_W > LCD_H - #define FILTER_COLUMNS 3 +#define FILTER_COLUMNS 3 #else - #define FILTER_COLUMNS 2 +#define FILTER_COLUMNS 2 #endif class SourceChoiceMenuToolbar : public MenuToolbar @@ -102,7 +102,8 @@ class SourceChoiceMenuToolbar : public MenuToolbar addButton(STR_CHAR_TELEMETRY, MIXSRC_FIRST_TELEM, MIXSRC_LAST_TELEM, nullptr, STR_MENU_TELEMETRY); - if ((nxtBtnPos > filterColumns) && choice->isValueAvailable && choice->isValueAvailable(0)) + if ((nxtBtnPos > filterColumns) && choice->isValueAvailable && + choice->isValueAvailable(0)) addButton(STR_SELECT_MENU_CLR, 0, 0, nullptr, nullptr, true); } }; diff --git a/radio/src/gui/colorlcd/switchchoice.cpp b/radio/src/gui/colorlcd/switchchoice.cpp index 5c0876071e1..7dcc2d9aca1 100644 --- a/radio/src/gui/colorlcd/switchchoice.cpp +++ b/radio/src/gui/colorlcd/switchchoice.cpp @@ -57,13 +57,15 @@ class SwitchChoiceMenuToolbar : public MenuToolbar }, STR_MENU_OTHER); - if ((nxtBtnPos > filterColumns) && choice->isValueAvailable && choice->isValueAvailable(0)) + if ((nxtBtnPos > filterColumns) && choice->isValueAvailable && + choice->isValueAvailable(0)) addButton(STR_SELECT_MENU_CLR, 0, 0, nullptr, nullptr, true); coord_t y = height() - MENUS_TOOLBAR_BUTTON_WIDTH - MENUS_TOOLBAR_BUTTON_PADDING; coord_t w = width() - MENUS_TOOLBAR_BUTTON_PADDING * 2; +#if defined(HARDWARE_TOUCH) invertBtn = new MenuToolbarButton( this, {MENUS_TOOLBAR_BUTTON_PADDING, y, w, MENUS_TOOLBAR_BUTTON_WIDTH}, STR_SELECT_MENU_INV); @@ -74,6 +76,7 @@ class SwitchChoiceMenuToolbar : public MenuToolbar longPress(); return choice->inverted; }); +#endif } void longPress() @@ -81,7 +84,9 @@ class SwitchChoiceMenuToolbar : public MenuToolbar SwitchChoice* switchChoice = (SwitchChoice*)choice; switchChoice->inverted = !switchChoice->inverted; switchChoice->fillMenu(menu, filter); +#if defined(HARDWARE_TOUCH) invertBtn->check(switchChoice->inverted); +#endif } protected: