diff --git a/src/Makefile b/src/Makefile index 0fff7f7f3..ea8889f92 100644 --- a/src/Makefile +++ b/src/Makefile @@ -62,6 +62,9 @@ HAPTIC = NO # SPLASH on START SPLASH = YES +# GRAPHICS (sliders / checkboxes) +GRAPHICS = YES + # PPM center adjustable # Values = YES, NO PPM_CENTER_ADJUSTABLE = NO @@ -245,6 +248,10 @@ ifeq ($(SPLASH), YES) CPPDEFS += -DSPLASH endif +ifeq ($(GRAPHICS), YES) + CPPDEFS += -DGRAPHICS +endif + ifeq ($(FLIGHT_PHASES), YES) CPPDEFS += -DFLIGHT_PHASES endif @@ -384,17 +391,17 @@ ifeq ($(DECIMALS), YES) endif ifeq ($(HELI), YES) - MODS:=${MODS}H - CPPDEFS += -DHELI + MODS:=${MODS}H + CPPDEFS += -DHELI endif ifeq ($(TEMPLATES), YES) - CPPDEFS += -DTEMPLATES - CPPSRC += templates.cpp + CPPDEFS += -DTEMPLATES + CPPSRC += templates.cpp endif ifeq ($(DISPLAY_USER_DATA), YES) - CPPDEFS += -DDISPLAY_USER_DATA + CPPDEFS += -DDISPLAY_USER_DATA endif ifeq ($(PXX), YES) diff --git a/src/general_menus.cpp b/src/general_menus.cpp index 319c656e5..1b12476ab 100644 --- a/src/general_menus.cpp +++ b/src/general_menus.cpp @@ -82,16 +82,30 @@ NOINLINE int8_t selectMenuItem(uint8_t y, const pm_char *label, const pm_char *v NOINLINE uint8_t onoffMenuItem(uint8_t value, uint8_t y, const pm_char *label, uint8_t attr, uint8_t event ) { +#if defined(GRAPHICS) menu_lcd_onoff(GENERAL_PARAM_OFS, y, value, attr); return selectMenuItem(y, label, NULL, value, 0, 1, attr, event); +#else + return selectMenuItem(y, label, STR_OFFON, value, 0, 1, attr, event); +#endif } +#if defined(GRAPHICS) void displaySlider(uint8_t x, uint8_t y, uint8_t value, uint8_t attr) { lcd_putc(GENERAL_PARAM_OFS+2*FW+(value*FW), y, '$'); lcd_hline(GENERAL_PARAM_OFS, y+3, 5*FW-1, SOLID); if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) lcd_filled_rect(GENERAL_PARAM_OFS, y, 5*FW-1, FH-1); } +#define SLIDER(y, value, min, max, label, values, event, attr) { \ + int8_t tmp = value; \ + displaySlider(GENERAL_PARAM_OFS, y, tmp, attr); \ + value = selectMenuItem(y, label, NULL, tmp, min, max, attr, event); \ + } +#else +#define SLIDER(y, value, min, max, label, values, event, attr) \ + value = selectMenuItem(y, label, values, value, min, max, attr, event) +#endif enum menuProcSetupItems { ITEM_SETUP_BEEPER_MODE, @@ -205,12 +219,9 @@ void menuProcSetup(uint8_t event) } #endif - case ITEM_SETUP_BEEPER_LENGTH: { - int8_t beeperLength = g_eeGeneral.beeperLength; - displaySlider(GENERAL_PARAM_OFS, y, beeperLength, attr); - g_eeGeneral.beeperLength = selectMenuItem(y, STR_BEEPERLEN, NULL, beeperLength, -2, 2, attr, event); + case ITEM_SETUP_BEEPER_LENGTH: + SLIDER(y, g_eeGeneral.beeperLength, -2, 2, STR_BEEPERLEN, STR_VBEEPLEN, event, attr); break; - } #if defined(AUDIO) case ITEM_SETUP_SPEAKER_PITCH: @@ -228,12 +239,8 @@ void menuProcSetup(uint8_t event) break; case ITEM_SETUP_HAPTIC_LENGTH: - { - int8_t hapticLength = g_eeGeneral.hapticLength; - displaySlider(GENERAL_PARAM_OFS, y, hapticLength, attr); - g_eeGeneral.hapticLength = selectMenuItem(y, STR_HAPTICLENGTH, NULL, hapticLength, -2, 2, attr, event); + SLIDER(y, g_eeGeneral.hapticLength, -2, 2, STR_HAPTICLENGTH, STR_VBEEPLEN, event, attr); break; - } case ITEM_SETUP_HAPTIC_STRENGTH: lcd_putsLeft( y, STR_HAPTICSTRENGTH); diff --git a/src/menus.cpp b/src/menus.cpp index 653cf017a..8513eb948 100644 --- a/src/menus.cpp +++ b/src/menus.cpp @@ -43,10 +43,7 @@ int16_t g_chans512[NUM_CHNOUT]; // TODO not here! void menu_lcd_onoff(uint8_t x,uint8_t y, uint8_t value, uint8_t attr) { -#if 0 - /* ON / OFF version */ - lcd_putsiAtt(x, y, STR_OFFON, value, attr ? INVERS:0) ; -#else +#if defined(GRAPHICS) if (value) { lcd_putc(x+1, y, '#'); } @@ -54,6 +51,9 @@ void menu_lcd_onoff(uint8_t x,uint8_t y, uint8_t value, uint8_t attr) lcd_filled_rect(x, y, 7, 7); else lcd_square(x, y, 7); +#else + /* ON / OFF version */ + lcd_putsiAtt(x, y, STR_OFFON, value, attr ? INVERS:0) ; #endif } diff --git a/src/o9xstrings.cpp b/src/o9xstrings.cpp index e032a93ec..cdcfd8d84 100644 --- a/src/o9xstrings.cpp +++ b/src/o9xstrings.cpp @@ -40,6 +40,9 @@ const pm_char STR_OPEN9X[] PROGMEM = ISTR(OFFON) ISTR(MMMINV) ISTR(NCHANNELS) +#if !defined(GRAPHICS) + ISTR(VBEEPLEN) +#endif ISTR(VBEEPMODE) #if defined(ROTARY_ENCODERS) ISTR(VRENAVIG) diff --git a/src/o9xstrings.h b/src/o9xstrings.h index 4fba995e1..a0f67da8b 100644 --- a/src/o9xstrings.h +++ b/src/o9xstrings.h @@ -63,7 +63,12 @@ extern const pm_char STR_OPEN9X[]; #define OFS_OFFON 0 #define OFS_MMMINV (OFS_OFFON + sizeof(TR_OFFON)) #define OFS_NCHANNELS (OFS_MMMINV + sizeof(TR_MMMINV)) +#if defined(GRAPHICS) #define OFS_VBEEPMODE (OFS_NCHANNELS + sizeof(TR_NCHANNELS)) +#else +#define OFS_VBEEPLEN (OFS_NCHANNELS + sizeof(TR_NCHANNELS)) +#define OFS_VBEEPMODE (OFS_VBEEPLEN + sizeof(TR_VBEEPLEN)) +#endif #if defined(ROTARY_ENCODERS) #define OFS_VRENAVIG (OFS_VBEEPMODE + sizeof(TR_VBEEPMODE)) #define OFS_VFILTERADC (OFS_VRENAVIG + sizeof(TR_VRENAVIG)) @@ -128,6 +133,9 @@ extern const pm_char STR_OPEN9X[]; #define STR_OFFON (STR_OPEN9X + OFS_OFFON) #define STR_MMMINV (STR_OPEN9X + OFS_MMMINV) #define STR_NCHANNELS (STR_OPEN9X + OFS_NCHANNELS) +#if !defined(GRAPHICS) +#define STR_VBEEPLEN (STR_OPEN9X + OFS_VBEEPLEN) +#endif #define STR_VBEEPMODE (STR_OPEN9X + OFS_VBEEPMODE) #define STR_VRENAVIG (STR_OPEN9X + OFS_VRENAVIG) #define STR_VFILTERADC (STR_OPEN9X + OFS_VFILTERADC) diff --git a/src/translations/cz.h b/src/translations/cz.h index b41ea50f3..4bd38d89b 100644 --- a/src/translations/cz.h +++ b/src/translations/cz.h @@ -11,6 +11,9 @@ #define LEN_VBEEPMODE "\005" #define TR_VBEEPMODE "Tich\212""Alarm""BezKL""V\207e " +#define LEN_VBEEPLEN "\005" +#define TR_VBEEPLEN "0====""=0===""==0==""===0=""====0" + #define LEN_VRENAVIG "\003" #define TR_VRENAVIG "Ne REaREb" diff --git a/src/translations/de.h b/src/translations/de.h index 0ce27a7a8..9065a4226 100644 --- a/src/translations/de.h +++ b/src/translations/de.h @@ -10,7 +10,10 @@ #define LEN_VBEEPMODE "\005" #define TR_VBEEPMODE "Stumm""Alarm""NoKey""Alle " - + +#define LEN_VBEEPLEN "\005" +#define TR_VBEEPLEN "0====""=0===""==0==""===0=""====0" + #define LEN_VRENAVIG "\003" #define TR_VRENAVIG "No REaREb" diff --git a/src/translations/en.h b/src/translations/en.h index b94a9ef1c..a23c561c6 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -11,6 +11,9 @@ #define LEN_VBEEPMODE "\005" #define TR_VBEEPMODE "Quiet""Alarm""NoKey""All " +#define LEN_VBEEPLEN "\005" +#define TR_VBEEPLEN "0====""=0===""==0==""===0=""====0" + #define LEN_VRENAVIG "\003" #define TR_VRENAVIG "No REaREb" diff --git a/src/translations/fr.h b/src/translations/fr.h index b05f6e955..0dd5f60a9 100644 --- a/src/translations/fr.h +++ b/src/translations/fr.h @@ -11,6 +11,9 @@ #define LEN_VBEEPMODE "\005" #define TR_VBEEPMODE "Aucun""Alarm""NoKey""Tout " +#define LEN_VBEEPLEN "\005" +#define TR_VBEEPLEN "0====""=0===""==0==""===0=""====0" + #define LEN_VRENAVIG "\003" #define TR_VRENAVIG "No REaREb" diff --git a/src/translations/it.h b/src/translations/it.h index 89ef9c3f5..1ba05c4bb 100644 --- a/src/translations/it.h +++ b/src/translations/it.h @@ -11,6 +11,9 @@ #define LEN_VBEEPMODE "\005" #define TR_VBEEPMODE "Silen""Avvis""Notst""Tutti" +#define LEN_VBEEPLEN "\005" +#define TR_VBEEPLEN "0====""=0===""==0==""===0=""====0" + #define LEN_VRENAVIG "\003" #define TR_VRENAVIG "No REaREb" diff --git a/src/translations/se.h b/src/translations/se.h index 237505a4e..8a6a3f1f3 100644 --- a/src/translations/se.h +++ b/src/translations/se.h @@ -11,6 +11,9 @@ #define LEN_VBEEPMODE "\005" #define TR_VBEEPMODE "Tyst ""Alarm""EjKnp""Alla " +#define LEN_VBEEPLEN "\005" +#define TR_VBEEPLEN "0====""=0===""==0==""===0=""====0" + #define LEN_VRENAVIG "\003" #define TR_VRENAVIG "No REaREb"