Fixes for "load at startup".

pull/111/head
Holger Wirtz 3 years ago
parent 89664703f9
commit 344c48dab1
  1. 57
      UI.hpp

@ -8061,24 +8061,29 @@ void UI_func_eq_7(uint8_t param)
void UI_func_startup(uint8_t param)
{
bool stored = false;
static uint8_t old_load_at_startup;
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
old_load_at_startup = configuration.sys.load_at_startup;
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("Load at startup"));
lcd.setCursor(0, 1);
lcd.show(0, 0, 16, "Load at startup");
if (configuration.sys.load_at_startup == 255)
lcd.print(F("Last Perf. "));
else if (configuration.sys.load_at_startup < 100)
lcd.show(1, 0, 16, "Last Perf.");
else if (configuration.sys.load_at_startup <= PERFORMANCE_NUM_MAX)
{
lcd.print(F("Fixed Perf. "));
lcd.print(configuration.sys.load_at_startup);
lcd.show(1, 0, 16, "Fixed Perf. [");
lcd.show(1, 13, 2, configuration.sys.load_at_startup);
lcd.show(1, 15, 1, "]");
}
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()))
{
if (LCDML.BT_checkDown())
{
@ -8096,26 +8101,38 @@ void UI_func_startup(uint8_t param)
else if (configuration.sys.load_at_startup >= PERFORMANCE_NUM_MIN && configuration.sys.load_at_startup <= PERFORMANCE_NUM_MAX)
configuration.sys.load_at_startup--;
}
}
else if (LCDML.BT_checkEnter())
{
stored = true;
lcd.show(1, 0, 16, "Done.");
save_sd_sys_json();
if (configuration.sys.load_at_startup <= PERFORMANCE_NUM_MAX && configuration.sys.load_at_startup != configuration.sys.performance_number)
load_sd_performance_json(configuration.sys.load_at_startup);
delay(MESSAGE_WAIT_TIME);
LCDML.FUNC_goBackToMenu();
}
lcd.setCursor(0, 1);
if (configuration.sys.load_at_startup == 255)
lcd.print(F("Last Perf. "));
else if (configuration.sys.load_at_startup < 100)
{
lcd.print(F("Fixed Perf. "));
lcd.setCursor(12, 1);
lcd.print(configuration.sys.load_at_startup);
lcd.setCursor(0, 1);
if (configuration.sys.load_at_startup == 255)
lcd.show(1, 0, 16, "Last Perf.");
else if (configuration.sys.load_at_startup <= PERFORMANCE_NUM_MAX)
{
lcd.show(1, 0, 16, "Fixed Perf. [");
lcd.show(1, 13, 2, configuration.sys.load_at_startup);
lcd.show(1, 15, 1, "]");
}
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
//lcd_special_chars(SCROLLBAR);
save_sd_sys_json();
if (configuration.sys.load_at_startup < 100 && configuration.sys.load_at_startup != configuration.sys.performance_number)
load_sd_performance_json(configuration.sys.load_at_startup);
if (stored == false)
{
lcd.show(1, 0, 16, "Canceled.");
configuration.sys.load_at_startup = old_load_at_startup;
delay(MESSAGE_WAIT_TIME);
}
encoderDir[ENC_R].reset();
}
}

Loading…
Cancel
Save