From 14f0f7ca106a3de6a391f0329872cfd85b4d0168 Mon Sep 17 00:00:00 2001 From: bsongis Date: Wed, 16 May 2012 15:16:52 +0000 Subject: [PATCH] Slider for beep length and haptic length. Thanks dvogonen for the idea and the screenshot! --- src/font.lbm | 2 +- src/font_6x1.xbm | 12 ++++++------ src/general_menus.cpp | 22 ++++++++++++++++++---- src/menus.cpp | 3 ++- src/o9xstrings.cpp | 1 - src/o9xstrings.h | 6 ++---- src/translations/cz.h | 3 --- src/translations/en.h | 3 --- src/translations/fr.h | 3 --- src/translations/it.h | 3 --- src/translations/se.h | 3 --- 11 files changed, 29 insertions(+), 32 deletions(-) diff --git a/src/font.lbm b/src/font.lbm index 9f124b2e0..0c3088c28 100644 --- a/src/font.lbm +++ b/src/font.lbm @@ -1,4 +1,4 @@ -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6f,0x00,0x00,0x07,0x00,0x07,0x00,0x14,0x7f,0x14,0x7f,0x14,0x24,0x2a,0x7f,0x2a,0x12,0x23,0x13,0x08,0x64,0x62,0x36,0x49,0x55,0x22,0x50,0x00,0x05,0x03,0x00,0x00,0x00,0x1c,0x22,0x41,0x00,0x00,0x41,0x22,0x1c,0x00,0x14,0x08,0x3e,0x08,0x14,0x08,0x08,0x3e,0x08,0x08,0x00,0x50,0x30,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x00,0x60,0x60,0x00,0x00,0x20,0x10,0x08,0x04,0x02, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6f,0x00,0x00,0x07,0x00,0x07,0x00,0x14,0x7f,0x14,0x7f,0x14,0x08,0x7f,0x7f,0x7f,0x08,0x23,0x13,0x08,0x64,0x62,0x36,0x49,0x55,0x22,0x50,0x00,0x05,0x03,0x00,0x00,0x00,0x1c,0x22,0x41,0x00,0x00,0x41,0x22,0x1c,0x00,0x14,0x08,0x3e,0x08,0x14,0x08,0x08,0x3e,0x08,0x08,0x00,0x50,0x30,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x00,0x60,0x60,0x00,0x00,0x20,0x10,0x08,0x04,0x02, 0x00,0x3e,0x41,0x41,0x3e,0x00,0x00,0x42,0x7f,0x40,0x00,0x62,0x51,0x49,0x46,0x00,0x41,0x49,0x49,0x36,0x00,0x18,0x14,0x12,0x7f,0x00,0x27,0x45,0x45,0x39,0x00,0x3e,0x49,0x49,0x32,0x00,0x01,0x79,0x05,0x03,0x00,0x36,0x49,0x49,0x36,0x00,0x06,0x49,0x29,0x1e,0x00,0x00,0x36,0x36,0x00,0x00,0x00,0x56,0x36,0x00,0x00,0x08,0x14,0x22,0x41,0x14,0x14,0x14,0x14,0x14,0x41,0x22,0x14,0x08,0x00,0x02,0x01,0x51,0x09,0x06, 0x06,0x09,0x09,0x06,0x00,0x7e,0x09,0x09,0x09,0x7e,0x7f,0x49,0x49,0x49,0x36,0x3e,0x41,0x41,0x41,0x22,0x7f,0x41,0x41,0x22,0x1c,0x7f,0x49,0x49,0x49,0x41,0x7f,0x09,0x09,0x09,0x01,0x3e,0x41,0x49,0x49,0x7a,0x7f,0x08,0x08,0x08,0x7f,0x00,0x41,0x7f,0x41,0x00,0x20,0x40,0x41,0x3f,0x01,0x7f,0x08,0x14,0x22,0x41,0x7f,0x40,0x40,0x40,0x40,0x7f,0x02,0x0c,0x02,0x7f,0x7f,0x04,0x08,0x10,0x7f,0x3e,0x41,0x41,0x41,0x3e, 0x7f,0x09,0x09,0x09,0x06,0x3e,0x41,0x51,0x21,0x5e,0x7f,0x09,0x19,0x29,0x46,0x26,0x49,0x49,0x49,0x32,0x01,0x01,0x7f,0x01,0x01,0x3f,0x40,0x40,0x40,0x3f,0x1f,0x20,0x40,0x20,0x1f,0x3f,0x40,0x30,0x40,0x3f,0x63,0x14,0x08,0x14,0x63,0x07,0x08,0x70,0x08,0x07,0x61,0x51,0x49,0x45,0x43,0x00,0x7f,0x41,0x41,0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x41,0x41,0x7f,0x00,0x04,0x02,0x01,0x02,0x04,0x40,0x40,0x40,0x40,0x40, diff --git a/src/font_6x1.xbm b/src/font_6x1.xbm index 49195b664..5de996e62 100644 --- a/src/font_6x1.xbm +++ b/src/font_6x1.xbm @@ -1,12 +1,12 @@ #define font_6x1_width 80 #define font_6x1_height 48 static unsigned char font_6x1_bits[] = { - 0x00, 0x29, 0x45, 0x86, 0x31, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, - 0xe5, 0x67, 0x22, 0x84, 0x10, 0x02, 0x00, 0x80, 0x00, 0xa9, 0x5f, 0x50, - 0x11, 0x02, 0x55, 0x02, 0x00, 0x40, 0x00, 0x01, 0xe5, 0x88, 0x00, 0x02, - 0xb9, 0x0f, 0x3c, 0x20, 0x00, 0x80, 0x4f, 0x45, 0x05, 0x02, 0x55, 0x62, - 0x00, 0x10, 0x00, 0x01, 0xf5, 0x72, 0x02, 0x84, 0x10, 0x42, 0x80, 0x09, - 0x00, 0x01, 0x45, 0xb0, 0x05, 0x48, 0x00, 0x20, 0x80, 0x01, 0x00, 0x00, + 0x00, 0x29, 0xe5, 0x86, 0x31, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, + 0xe5, 0x66, 0x22, 0x84, 0x10, 0x02, 0x00, 0x80, 0x00, 0xa9, 0xef, 0x50, + 0x11, 0x02, 0x55, 0x02, 0x00, 0x40, 0x00, 0x01, 0xf5, 0x89, 0x00, 0x02, + 0xb9, 0x0f, 0x3c, 0x20, 0x00, 0x80, 0xef, 0x44, 0x05, 0x02, 0x55, 0x62, + 0x00, 0x10, 0x00, 0x01, 0xe5, 0x72, 0x02, 0x84, 0x10, 0x42, 0x80, 0x09, + 0x00, 0x01, 0xe5, 0xb0, 0x05, 0x48, 0x00, 0x20, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x31, 0x07, 0x3d, 0xf3, 0x8c, 0x01, 0x00, 0x41, 0x70, 0x92, 0x49, 0x88, 0x85, 0x84, 0x52, 0x32, 0x86, 0x80, 0x88, 0x12, 0x41, 0x48, 0x9d, 0x40, 0x52, 0x32, 0x46, diff --git a/src/general_menus.cpp b/src/general_menus.cpp index eb7177bb0..fd658b147 100644 --- a/src/general_menus.cpp +++ b/src/general_menus.cpp @@ -75,7 +75,7 @@ const MenuFuncP_PROGMEM menuTabDiag[] PROGMEM = { NOINLINE int8_t selectMenuItem(uint8_t y, const pm_char *label, const pm_char *values, int8_t value, int8_t min, int8_t max, uint8_t attr, uint8_t event) { lcd_putsLeft(y, label); - lcd_putsiAtt(GENERAL_PARAM_OFS, y, values, value-min, attr) ; + if (values) lcd_putsiAtt(GENERAL_PARAM_OFS, y, values, value-min, attr) ; if (attr) CHECK_INCDEC_GENVAR(event, value, min, max); return value; } @@ -85,6 +85,13 @@ NOINLINE uint8_t onoffMenuItem(uint8_t value, uint8_t y, const pm_char *label, u return selectMenuItem(y, label, STR_OFFON, value, 0, 1, attr, event); } +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, SOLID); + if (attr) lcd_filled_rect(GENERAL_PARAM_OFS, y, 5*FW, FH-1); +} + enum menuProcSetupItems { ITEM_SETUP_BEEPER_MODE, #if defined(PCBARM) @@ -198,9 +205,12 @@ void menuProcSetup(uint8_t event) } #endif - case ITEM_SETUP_BEEPER_LENGTH: - g_eeGeneral.beeperLength = selectMenuItem(y, STR_BEEPERLEN, STR_VBEEPLEN, g_eeGeneral.beeperLength, -2, 2, attr, event); + 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); break; + } #if defined(AUDIO) case ITEM_SETUP_SPEAKER_PITCH: @@ -218,8 +228,12 @@ void menuProcSetup(uint8_t event) break; case ITEM_SETUP_HAPTIC_LENGTH: - g_eeGeneral.hapticLength = selectMenuItem(y, STR_HAPTICLENGTH, STR_VBEEPLEN, g_eeGeneral.hapticLength, -2, 2, attr, event); + { + int8_t hapticLength = g_eeGeneral.hapticLength; + displaySlider(GENERAL_PARAM_OFS, y, hapticLength, attr); + g_eeGeneral.hapticLength = selectMenuItem(y, STR_BEEPERLEN, NULL, hapticLength, -2, 2, attr, event); break; + } case ITEM_SETUP_HAPTIC_STRENGTH: lcd_putsLeft( y, STR_HAPTICSTRENGTH); diff --git a/src/menus.cpp b/src/menus.cpp index 9a79ba200..c010f7fc8 100644 --- a/src/menus.cpp +++ b/src/menus.cpp @@ -363,7 +363,8 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa break; #endif case EVT_KEY_FIRST(KEY_MENU): - s_editMode = (s_editMode<=0); + if (!menuTab || m_posVert>0) + s_editMode = (s_editMode<=0); break; case EVT_KEY_LONG(KEY_EXIT): s_editMode = 0; diff --git a/src/o9xstrings.cpp b/src/o9xstrings.cpp index 0ca333bea..8f2b494d4 100644 --- a/src/o9xstrings.cpp +++ b/src/o9xstrings.cpp @@ -41,7 +41,6 @@ const pm_char STR_OPEN9X[] PROGMEM = ISTR(MMMINV) ISTR(NCHANNELS) ISTR(VBEEPMODE) - ISTR(VBEEPLEN) #if defined(ROTARY_ENCODERS) ISTR(VRENAVIG) #endif diff --git a/src/o9xstrings.h b/src/o9xstrings.h index 44da0524b..99be2aabe 100644 --- a/src/o9xstrings.h +++ b/src/o9xstrings.h @@ -61,12 +61,11 @@ extern const pm_char STR_OPEN9X[]; #define OFS_MMMINV (OFS_OFFON + sizeof(TR_OFFON)) #define OFS_NCHANNELS (OFS_MMMINV + sizeof(TR_MMMINV)) #define OFS_VBEEPMODE (OFS_NCHANNELS + sizeof(TR_NCHANNELS)) -#define OFS_VBEEPLEN (OFS_VBEEPMODE + sizeof(TR_VBEEPMODE)) #if defined(ROTARY_ENCODERS) -#define OFS_VRENAVIG (OFS_VBEEPLEN + sizeof(TR_VBEEPLEN)) +#define OFS_VRENAVIG (OFS_VBEEPMODE + sizeof(TR_VBEEPMODE)) #define OFS_VFILTERADC (OFS_VRENAVIG + sizeof(TR_VRENAVIG)) #else -#define OFS_VFILTERADC (OFS_VBEEPLEN + sizeof(TR_VBEEPLEN)) +#define OFS_VFILTERADC (OFS_VBEEPMODE + sizeof(TR_VBEEPMODE)) #endif #define OFS_WARNSW (OFS_VFILTERADC + sizeof(TR_VFILTERADC)) #define OFS_TRNMODE (OFS_WARNSW + sizeof(TR_WARNSW)) @@ -128,7 +127,6 @@ extern const pm_char STR_OPEN9X[]; #define STR_MMMINV (STR_OPEN9X + OFS_MMMINV) #define STR_NCHANNELS (STR_OPEN9X + OFS_NCHANNELS) #define STR_VBEEPMODE (STR_OPEN9X + OFS_VBEEPMODE) -#define STR_VBEEPLEN (STR_OPEN9X + OFS_VBEEPLEN) #define STR_VRENAVIG (STR_OPEN9X + OFS_VRENAVIG) #define STR_VFILTERADC (STR_OPEN9X + OFS_VFILTERADC) #define STR_WARNSW (STR_OPEN9X + OFS_WARNSW) diff --git a/src/translations/cz.h b/src/translations/cz.h index b9e1f0232..bbfaf1c35 100644 --- a/src/translations/cz.h +++ b/src/translations/cz.h @@ -11,9 +11,6 @@ #define LEN_VBEEPMODE "\005" #define TR_VBEEPMODE "Tichy""Alarm""BezKL""Vse " -#define LEN_VBEEPLEN "\005" -#define TR_VBEEPLEN "O====""=O===""==O==""===O=""====O" - #define LEN_VRENAVIG "\003" #define TR_VRENAVIG "Ne REaREb" diff --git a/src/translations/en.h b/src/translations/en.h index f4fa412b9..e7bf30a48 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -11,9 +11,6 @@ #define LEN_VBEEPMODE "\005" #define TR_VBEEPMODE "Quiet""Alarm""NoKey""All " -#define LEN_VBEEPLEN "\005" -#define TR_VBEEPLEN "xShrt""Short""Norml""Long ""xLong" - #define LEN_VRENAVIG "\003" #define TR_VRENAVIG "No REaREb" diff --git a/src/translations/fr.h b/src/translations/fr.h index 580a4030c..ef6a71b0b 100644 --- a/src/translations/fr.h +++ b/src/translations/fr.h @@ -11,9 +11,6 @@ #define LEN_VBEEPMODE "\005" #define TR_VBEEPMODE "Quiet""Alarm""NoKey""Tout " -#define LEN_VBEEPLEN "\005" -#define TR_VBEEPLEN "xShrt""Short""Norml""Long ""xLong" - #define LEN_VRENAVIG "\003" #define TR_VRENAVIG "No REaREb" diff --git a/src/translations/it.h b/src/translations/it.h index 3fe78a518..cb048fefc 100644 --- a/src/translations/it.h +++ b/src/translations/it.h @@ -11,9 +11,6 @@ #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 889f316e4..21cde799a 100644 --- a/src/translations/se.h +++ b/src/translations/se.h @@ -11,9 +11,6 @@ #define LEN_VBEEPMODE "\005" #define TR_VBEEPMODE "Tyst ""Alarm""EjKnp""Alla " -#define LEN_VBEEPLEN "\005" -#define TR_VBEEPLEN "xKort""Kort ""Medel""L\200ng ""xL\200ng" - #define LEN_VRENAVIG "\003" #define TR_VRENAVIG "No REaREb"