diff --git a/radio/src/gui/menu_general.cpp b/radio/src/gui/menu_general.cpp index 88ac1fe73..673b514a4 100644 --- a/radio/src/gui/menu_general.cpp +++ b/radio/src/gui/menu_general.cpp @@ -110,33 +110,19 @@ const MenuFuncP_PROGMEM menuTabDiag[] PROGMEM = { #endif #if !defined(CPUM64) - void displaySlider(uint8_t x, uint8_t y, uint8_t value, uint8_t max, uint8_t attr) - { - lcd_putc(RADIO_SETUP_2ND_COLUMN+(value*4*FW)/max, y, '$'); - lcd_hline(RADIO_SETUP_2ND_COLUMN, y+3, 5*FW-1, SOLID); - if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) lcd_filled_rect(RADIO_SETUP_2ND_COLUMN, y, 5*FW-1, FH-1); - } #define SLIDER_5POS(y, value, label, event, attr) { \ int8_t tmp = value; \ displaySlider(RADIO_SETUP_2ND_COLUMN, y, 2+tmp, 4, attr); \ value = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, label, NULL, tmp, -2, +2, attr, event); \ } #elif defined(GRAPHICS) - void display5posSlider(uint8_t x, uint8_t y, uint8_t value, uint8_t attr) - { - lcd_putc(RADIO_SETUP_2ND_COLUMN+2*FW+(value*FW), y, '$'); - lcd_hline(RADIO_SETUP_2ND_COLUMN, y+3, 5*FW-1, SOLID); - if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) lcd_filled_rect(RADIO_SETUP_2ND_COLUMN, y, 5*FW-1, FH-1); - } #define SLIDER_5POS(y, value, label, event, attr) { \ int8_t tmp = value; \ display5posSlider(RADIO_SETUP_2ND_COLUMN, y, tmp, attr); \ value = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, label, NULL, tmp, -2, +2, attr, event); \ } - #define displaySlider(x, y, value, max, attr) lcd_outdezAtt(x, y, value, attr|LEFT) #else #define SLIDER_5POS(y, value, label, event, attr) value = selectMenuItem(RADIO_SETUP_2ND_COLUMN, y, label, STR_VBEEPLEN, value, -2, +2, attr, event) - #define displaySlider(x, y, value, max, attr) lcd_outdezAtt(x, y, value, attr|LEFT) #endif #if defined(SPLASH) && !defined(FSPLASH) diff --git a/radio/src/gui/menus.cpp b/radio/src/gui/menus.cpp index 0c8e0a136..1897b68be 100644 --- a/radio/src/gui/menus.cpp +++ b/radio/src/gui/menus.cpp @@ -1136,6 +1136,22 @@ int8_t switchMenuItem(uint8_t x, uint8_t y, int8_t value, LcdFlags attr, uint8_t return value; } +#if !defined(CPUM64) + void displaySlider(uint8_t x, uint8_t y, uint8_t value, uint8_t max, uint8_t attr) + { + lcd_putc(x+(value*4*FW)/max, y, '$'); + lcd_hline(x, y+3, 5*FW-1, SOLID); + if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) lcd_filled_rect(x, y, 5*FW-1, FH-1); + } +#elif defined(GRAPHICS) + void display5posSlider(uint8_t x, uint8_t y, uint8_t value, uint8_t attr) + { + lcd_putc(x+2*FW+(value*FW), y, '$'); + lcd_hline(x, y+3, 5*FW-1, SOLID); + if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) lcd_filled_rect(x, y, 5*FW-1, FH-1); + } +#endif + #if defined(GVARS) #if defined(CPUARM) int16_t gvarMenuItem(uint8_t x, uint8_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, uint8_t event) diff --git a/radio/src/gui/menus.h b/radio/src/gui/menus.h index 7def27e21..5a1f516f7 100644 --- a/radio/src/gui/menus.h +++ b/radio/src/gui/menus.h @@ -138,6 +138,15 @@ void menuStatisticsView(uint8_t event); void menuStatisticsDebug(uint8_t event); void menuAboutView(uint8_t event); +#if !defined(CPUM64) + void displaySlider(uint8_t x, uint8_t y, uint8_t value, uint8_t max, uint8_t attr); +#elif defined(GRAPHICS) + void display5posSlider(uint8_t x, uint8_t y, uint8_t value, uint8_t attr); + #define displaySlider(x, y, value, max, attr) lcd_outdezAtt(x, y, value, attr|LEFT) +#else + #define displaySlider(x, y, value, max, attr) lcd_outdezAtt(x, y, value, attr|LEFT) +#endif + #if defined(PCBTARANIS) void menuMainViewChannelsMonitor(uint8_t event); void menuChannelsView(uint8_t event);