From 000b400b200b234fc85f45c631bbce5bb3bbdb81 Mon Sep 17 00:00:00 2001 From: eshifri Date: Tue, 10 Aug 2021 17:01:28 -0700 Subject: [PATCH 1/2] touch interface support for time_edit --- radio/src/hal/adc_driver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/src/hal/adc_driver.cpp b/radio/src/hal/adc_driver.cpp index 831f8037b..e17d52184 100644 --- a/radio/src/hal/adc_driver.cpp +++ b/radio/src/hal/adc_driver.cpp @@ -67,7 +67,7 @@ const etx_hal_adc_driver_t* etx_hal_adc_driver = nullptr; const uint8_t adcMapping[NUM_ANALOGS] = { 0 /*STICK1*/, 1 /*STICK2*/, 2 /*STICK3*/, 3 /*STICK4*/, 4 /*POT1*/, 5 /*POT2*/, 6 /*SWA*/, 14 /*SWB*/, 7 /*SWC*/, 15 /*SWD*/, 8 /*SWE*/, 9 /*SWF*/, - 10/*SWG*/, 11/*SWH*/, + 11/*SWG*/, 10/*SWH*/, 12 /*TX_VOLTAGE*/, 13 /* TX_VBAT */ }; const int8_t adcDirection[NUM_ANALOGS] = { 0 /*STICK1*/, 0 /*STICK2*/, 0 /*STICK3*/, 0 /*STICK4*/, From ff5e15cce72aa255f117328788fca9a5fe04f75e Mon Sep 17 00:00:00 2001 From: eshifri Date: Tue, 10 Aug 2021 17:04:12 -0700 Subject: [PATCH 2/2] Split number of topbar widgets for vertical and horizontal LCD. Add Exit button to topbar widgets setup. --- radio/src/gui/colorlcd/topbar.cpp | 9 +++++++++ radio/src/gui/colorlcd/widgets_container.h | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/radio/src/gui/colorlcd/topbar.cpp b/radio/src/gui/colorlcd/topbar.cpp index fe18dd59f..290f23d41 100644 --- a/radio/src/gui/colorlcd/topbar.cpp +++ b/radio/src/gui/colorlcd/topbar.cpp @@ -57,6 +57,15 @@ SetupTopBarWidgetsPage::SetupTopBarWidgetsPage(ScreenMenu* menu): auto widget = new SetupWidgetsPageSlot(this, rect, topbar, i); if (i == 0) widget->setFocus(); } +#if defined(HARDWARE_TOUCH) + new Button( + this, {0, 0, MENU_HEADER_BUTTON_WIDTH, MENU_HEADER_BUTTON_WIDTH}, + [this]() -> uint8_t { + this->deleteLater(); + return 1; + }, + NO_FOCUS | FORM_NO_BORDER); +#endif } void SetupTopBarWidgetsPage::deleteLater(bool detach, bool trash) diff --git a/radio/src/gui/colorlcd/widgets_container.h b/radio/src/gui/colorlcd/widgets_container.h index 754bbec11..85e04a4dc 100644 --- a/radio/src/gui/colorlcd/widgets_container.h +++ b/radio/src/gui/colorlcd/widgets_container.h @@ -29,7 +29,11 @@ #define WIDGET_NAME_LEN 10 #define MAX_WIDGET_OPTIONS 5 // Name? +#if LCD_W > LCD_H #define MAX_TOPBAR_ZONES 4 +#else +#define MAX_TOPBAR_ZONES 2 +#endif #define MAX_TOPBAR_OPTIONS 1 // just because of VC++ which doesn't like 0-size arrays :( // Common 'ZoneOptionValue's among all layouts