mirror of
https://github.com/opentx/opentx.git
synced 2025-07-24 00:35:18 +03:00
Make displaySlider generally available
This commit is contained in:
parent
57d541efc1
commit
7600924d94
3 changed files with 25 additions and 14 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue