Fixes for "load at startup".

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

@ -8061,24 +8061,29 @@ void UI_func_eq_7(uint8_t param)
void UI_func_startup(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 ********* if (LCDML.FUNC_setup()) // ****** SETUP *********
{ {
old_load_at_startup = configuration.sys.load_at_startup;
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print(F("Load at startup")); lcd.show(0, 0, 16, "Load at startup");
lcd.setCursor(0, 1);
if (configuration.sys.load_at_startup == 255) if (configuration.sys.load_at_startup == 255)
lcd.print(F("Last Perf. ")); lcd.show(1, 0, 16, "Last Perf.");
else if (configuration.sys.load_at_startup < 100) else if (configuration.sys.load_at_startup <= PERFORMANCE_NUM_MAX)
{ {
lcd.print(F("Fixed Perf. ")); lcd.show(1, 0, 16, "Fixed Perf. [");
lcd.print(configuration.sys.load_at_startup); lcd.show(1, 13, 2, configuration.sys.load_at_startup);
lcd.show(1, 15, 1, "]");
} }
} }
if (LCDML.FUNC_loop()) // ****** LOOP ********* 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()) 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) else if (configuration.sys.load_at_startup >= PERFORMANCE_NUM_MIN && configuration.sys.load_at_startup <= PERFORMANCE_NUM_MAX)
configuration.sys.load_at_startup--; 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); lcd.setCursor(0, 1);
if (configuration.sys.load_at_startup == 255) if (configuration.sys.load_at_startup == 255)
lcd.print(F("Last Perf. ")); lcd.show(1, 0, 16, "Last Perf.");
else if (configuration.sys.load_at_startup < 100) else if (configuration.sys.load_at_startup <= PERFORMANCE_NUM_MAX)
{ {
lcd.print(F("Fixed Perf. ")); lcd.show(1, 0, 16, "Fixed Perf. [");
lcd.setCursor(12, 1); lcd.show(1, 13, 2, configuration.sys.load_at_startup);
lcd.print(configuration.sys.load_at_startup); lcd.show(1, 15, 1, "]");
}
} }
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
{ {
//lcd_special_chars(SCROLLBAR); //lcd_special_chars(SCROLLBAR);
save_sd_sys_json(); if (stored == false)
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); lcd.show(1, 0, 16, "Canceled.");
configuration.sys.load_at_startup = old_load_at_startup;
delay(MESSAGE_WAIT_TIME);
}
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
} }
} }

Loading…
Cancel
Save