Slider for beep length and haptic length. Thanks dvogonen for the idea and the screenshot!

This commit is contained in:
bsongis
2012-05-16 15:16:52 +00:00
parent 32ce85fc20
commit 14f0f7ca10
11 changed files with 29 additions and 32 deletions
+18 -4
View File
@@ -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);