Optimizations for showing volume level.

pull/11/head
Holger Wirtz 5 years ago
parent 8bb05fd1c2
commit ebd213b1ee
  1. 25
      UI.hpp

@ -565,7 +565,7 @@ void encoder_left_up(void)
soften_volume.update(soften_volume.value() + (VOLUME_MAX - VOLUME_MIN) / VOLUME_ENC_STEPS, SOFTEN_VALUE_CHANGE_STEPS); soften_volume.update(soften_volume.value() + (VOLUME_MAX - VOLUME_MIN) / VOLUME_ENC_STEPS, SOFTEN_VALUE_CHANGE_STEPS);
else else
configuration.vol = VOLUME_MAX; configuration.vol = VOLUME_MAX;
eeprom_write();
UI_func_volume(0); UI_func_volume(0);
} }
@ -579,7 +579,7 @@ void encoder_left_down(void)
soften_volume.update(tmp, SOFTEN_VALUE_CHANGE_STEPS); soften_volume.update(tmp, SOFTEN_VALUE_CHANGE_STEPS);
else else
configuration.vol = VOLUME_MIN; configuration.vol = VOLUME_MIN;
eeprom_write();
UI_func_volume(0); UI_func_volume(0);
} }
@ -1730,24 +1730,27 @@ void UI_func_volume(uint8_t param)
Serial.println(F("UI_func_volume()")); Serial.println(F("UI_func_volume()"));
#endif #endif
menu_state = MENU_VOLUME;
back_from_volume = 0; back_from_volume = 0;
// update LCD content if (menu_state != MENU_VOLUME)
LCDML.DISP_clear(); {
lcd.show(0, 0, 8, "Volume: "); lcd.show(0, 0, LCD_cols, "Volume:");
lcd.show(0, 9, 3, configuration.vol); lcd.show(1, 0, LCD_cols, "[ ]");
menu_state = MENU_VOLUME;
}
lcd.setCursor(8, 0);
lcd_display_int(configuration.vol, 3, true, false, false);
lcd.setCursor(1, 1); lcd.setCursor(1, 1);
for (uint8_t i = 0; i < LCD_cols; i++) for (uint8_t i = 0; i < LCD_cols - 2; i++)
{ {
if (i < int((LCD_cols - 2) * configuration.vol / 100.0)) if (i < int(((LCD_cols - 2) * configuration.vol / 100.0) + 0.5))
lcd.print(F("*")); lcd.print(F("*"));
else else
lcd.print(F(" ")); lcd.print(F(" "));
} }
set_volume(configuration.vol, configuration.pan[0], configuration.mono); set_volume(configuration.vol, configuration.pan[0], configuration.mono);
lcd.show(1, 0, 1, "["); eeprom_write();
lcd.show(1, 15, 1, "]");
} }
void UI_function_not_enabled(void) void UI_function_not_enabled(void)

Loading…
Cancel
Save