Added menu for "load at startup".

pull/111/head
Holger Wirtz 3 years ago
parent cee32d9462
commit 89664703f9
  1. 42
      MicroDexed.ino
  2. 67
      UI.hpp
  3. 7
      UI_FX.h
  4. 7
      UI_FX_T4.h
  5. 7
      UI_NO_FX.h
  6. 9
      config.h
  7. 4
      dexed_sd.cpp

@ -418,7 +418,7 @@ void setup()
sgtl5000.enable(); sgtl5000.enable();
sgtl5000.lineOutLevel(SGTL5000_LINEOUT_LEVEL); sgtl5000.lineOutLevel(SGTL5000_LINEOUT_LEVEL);
sgtl5000.dacVolumeRamp(); sgtl5000.dacVolumeRamp();
//sgtl5000.dacVolume(1.0); // doing this at the end of setup() sgtl5000.dacVolume(1.0);
//sgtl5000.dacVolumeRampLinear(); //sgtl5000.dacVolumeRampLinear();
//sgtl5000.dacVolumeRampDisable(); //sgtl5000.dacVolumeRampDisable();
sgtl5000.unmuteHeadphone(); sgtl5000.unmuteHeadphone();
@ -645,10 +645,6 @@ void setup()
strcpy(seq_name, "INIT Perf"); strcpy(seq_name, "INIT Perf");
LCDML.OTHER_jumpToFunc(UI_func_voice_select); LCDML.OTHER_jumpToFunc(UI_func_voice_select);
#if defined(TEENSY_AUDIO_BOARD)
sgtl5000.dacVolume(1.0);
#endif
} }
void loop() void loop()
@ -1930,15 +1926,31 @@ void initial_values(bool init)
} }
else else
{ {
uint8_t eeprom_performance = EEPROM[EEPROM_START_ADDRESS + 2]; load_sd_sys_json();
if (configuration.sys.load_at_startup == 255)
{
#ifdef DEBUG #ifdef DEBUG
Serial.print(F("Loading initial system data from performance ")); Serial.print(F("Loading initial system data from performance "));
Serial.println(eeprom_performance, DEC); Serial.println(configuration.sys.performance_number, DEC);
#endif #endif
load_sd_performance_json(configuration.sys.performance_number);
load_sd_performance_json(eeprom_performance); }
load_sd_sys_json(); else if (configuration.sys.load_at_startup < 100)
{
#ifdef DEBUG
Serial.print(F("Loading initial system data from performance "));
Serial.println(configuration.sys.load_at_startup, DEC);
#endif
load_sd_performance_json(configuration.sys.load_at_startup);
}
else
{
#ifdef DEBUG
Serial.print(F("Loading initial system data from default performance "));
Serial.println(STARTUP_NUM_DEFAULT, DEC);
#endif
load_sd_performance_json(STARTUP_NUM_DEFAULT);
}
} }
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("OK, loaded!")); Serial.println(F("OK, loaded!"));
@ -1946,7 +1958,7 @@ void initial_values(bool init)
check_configuration(); check_configuration();
} }
configuration.sys.vol = EEPROM[EEPROM_START_ADDRESS + 3]; configuration.sys.vol = EEPROM[EEPROM_START_ADDRESS + 2];
set_volume(configuration.sys.vol, configuration.sys.mono); set_volume(configuration.sys.vol, configuration.sys.mono);
#ifdef DEBUG #ifdef DEBUG
@ -1970,6 +1982,7 @@ void check_configuration_sys(void)
configuration.sys.soft_midi_thru = constrain(configuration.sys.soft_midi_thru, SOFT_MIDI_THRU_MIN, SOFT_MIDI_THRU_MAX); configuration.sys.soft_midi_thru = constrain(configuration.sys.soft_midi_thru, SOFT_MIDI_THRU_MIN, SOFT_MIDI_THRU_MAX);
configuration.sys.favorites = constrain(configuration.sys.favorites, FAVORITES_NUM_MIN, FAVORITES_NUM_MAX); configuration.sys.favorites = constrain(configuration.sys.favorites, FAVORITES_NUM_MIN, FAVORITES_NUM_MAX);
configuration.sys.performance_number = constrain(configuration.sys.performance_number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); configuration.sys.performance_number = constrain(configuration.sys.performance_number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX);
configuration.sys.load_at_startup = constrain(configuration.sys.load_at_startup, STARTUP_NUM_MIN, STARTUP_NUM_MAX);
} }
void check_configuration_fx(void) void check_configuration_fx(void)
@ -2065,6 +2078,7 @@ void init_configuration(void)
configuration.sys.mono = MONO_DEFAULT; configuration.sys.mono = MONO_DEFAULT;
configuration.sys.soft_midi_thru = SOFT_MIDI_THRU_DEFAULT; configuration.sys.soft_midi_thru = SOFT_MIDI_THRU_DEFAULT;
configuration.sys.performance_number = PERFORMANCE_NUM_DEFAULT; configuration.sys.performance_number = PERFORMANCE_NUM_DEFAULT;
configuration.sys.load_at_startup = STARTUP_NUM_DEFAULT;
#ifdef USE_PLATEREVERB #ifdef USE_PLATEREVERB
configuration.fx.reverb_lowpass = REVERB_LOWPASS_DEFAULT; configuration.fx.reverb_lowpass = REVERB_LOWPASS_DEFAULT;
@ -2145,8 +2159,7 @@ void eeprom_update(void)
{ {
EEPROM.update(EEPROM_START_ADDRESS, (EEPROM_MARKER & 0xff00) >> 8); EEPROM.update(EEPROM_START_ADDRESS, (EEPROM_MARKER & 0xff00) >> 8);
EEPROM.update(EEPROM_START_ADDRESS + 1, EEPROM_MARKER & 0xff); EEPROM.update(EEPROM_START_ADDRESS + 1, EEPROM_MARKER & 0xff);
EEPROM.update(EEPROM_START_ADDRESS + 2, configuration.sys.performance_number); EEPROM.update(EEPROM_START_ADDRESS + 2, configuration.sys.vol);
EEPROM.update(EEPROM_START_ADDRESS + 3, configuration.sys.vol);
} }
/****************************************************************************** /******************************************************************************
@ -2777,6 +2790,7 @@ void show_configuration(void)
Serial.print(F(" Soft MIDI Thru ")); Serial.println(configuration.sys.soft_midi_thru, DEC); Serial.print(F(" Soft MIDI Thru ")); Serial.println(configuration.sys.soft_midi_thru, DEC);
Serial.print(F(" Favorites ")); Serial.println(configuration.sys.favorites, DEC); Serial.print(F(" Favorites ")); Serial.println(configuration.sys.favorites, DEC);
Serial.print(F(" Performance Number ")); Serial.println(configuration.sys.performance_number, DEC); Serial.print(F(" Performance Number ")); Serial.println(configuration.sys.performance_number, DEC);
Serial.print(F(" Load at startup ")); Serial.println(configuration.sys.load_at_startup, DEC);
Serial.println(F("FX")); Serial.println(F("FX"));
Serial.print(F(" Reverb Roomsize ")); Serial.println(configuration.fx.reverb_roomsize, DEC); Serial.print(F(" Reverb Roomsize ")); Serial.println(configuration.fx.reverb_roomsize, DEC);
Serial.print(F(" Reverb Level ")); Serial.println(configuration.fx.reverb_level, DEC); Serial.print(F(" Reverb Level ")); Serial.println(configuration.fx.reverb_level, DEC);

@ -333,6 +333,7 @@ void UI_func_eq_4(uint8_t param);
void UI_func_eq_5(uint8_t param); void UI_func_eq_5(uint8_t param);
void UI_func_eq_6(uint8_t param); void UI_func_eq_6(uint8_t param);
void UI_func_eq_7(uint8_t param); void UI_func_eq_7(uint8_t param);
void UI_func_startup(uint8_t param);
void UI_function_not_enabled(void); void UI_function_not_enabled(void);
void UI_function_not_implemented(uint8_t param); void UI_function_not_implemented(uint8_t param);
void UI_func_favorites(uint8_t param); void UI_func_favorites(uint8_t param);
@ -6275,9 +6276,13 @@ void UI_func_load_performance(uint8_t param)
delay(MESSAGE_WAIT_TIME); delay(MESSAGE_WAIT_TIME);
} }
else else
{
configuration.sys.performance_number = temp_int;
save_sd_sys_json();
encoderDir[ENC_R].reset(); encoderDir[ENC_R].reset();
} }
} }
}
void UI_func_save_performance(uint8_t param) void UI_func_save_performance(uint8_t param)
{ {
@ -6350,7 +6355,6 @@ void UI_func_save_performance(uint8_t param)
sprintf(tmp, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, temp_int, PERFORMANCE_CONFIG_NAME); sprintf(tmp, "/%s/%d/%s.json", PERFORMANCE_CONFIG_PATH, temp_int, PERFORMANCE_CONFIG_NAME);
SD.remove(tmp); SD.remove(tmp);
} }
save_sd_performance_json(temp_int);
lcd.show(1, 0, 16, "Done."); lcd.show(1, 0, 16, "Done.");
seq_state_last_loadsave = temp_int; seq_state_last_loadsave = temp_int;
delay(MESSAGE_WAIT_TIME); delay(MESSAGE_WAIT_TIME);
@ -8055,6 +8059,67 @@ void UI_func_eq_7(uint8_t param)
#endif #endif
} }
void UI_func_startup(uint8_t param)
{
if (LCDML.FUNC_setup()) // ****** SETUP *********
{
encoderDir[ENC_R].reset();
lcd.setCursor(0, 0);
lcd.print(F("Load at startup"));
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.print(configuration.sys.load_at_startup);
}
}
if (LCDML.FUNC_loop()) // ****** LOOP *********
{
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()))
{
if (LCDML.BT_checkDown())
{
if (configuration.sys.load_at_startup == 255)
configuration.sys.load_at_startup = PERFORMANCE_NUM_MIN;
else if (configuration.sys.load_at_startup >= 0 && configuration.sys.load_at_startup <= PERFORMANCE_NUM_MAX)
configuration.sys.load_at_startup++;
if (configuration.sys.load_at_startup > PERFORMANCE_NUM_MAX)
configuration.sys.load_at_startup = 255;
}
else if (LCDML.BT_checkUp())
{
if (configuration.sys.load_at_startup == 255)
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--;
}
}
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);
}
}
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);
encoderDir[ENC_R].reset();
}
}
void UI_function_not_enabled(void) void UI_function_not_enabled(void)
{ {
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********

@ -132,7 +132,8 @@ LCDML_add(98, LCDML_0, 6, "System", NULL);
LCDML_add(99, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono); LCDML_add(99, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(100, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); LCDML_add(100, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(101, LCDML_0_6, 3, "Favorites", UI_func_favorites); LCDML_add(101, LCDML_0_6, 3, "Favorites", UI_func_favorites);
LCDML_add(102, LCDML_0, 7, "Info", UI_func_information); LCDML_add(102, LCDML_0_6, 4, "Startup", UI_func_startup);
LCDML_addAdvanced(103, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); LCDML_add(103, LCDML_0, 7, "Info", UI_func_information);
#define _LCDML_DISP_cnt 103 LCDML_addAdvanced(104, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 104
#endif #endif

@ -140,7 +140,8 @@ LCDML_add(106, LCDML_0, 5, "System", NULL);
LCDML_add(107, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono); LCDML_add(107, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(108, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); LCDML_add(108, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(109, LCDML_0_5, 3, "Favorites", UI_func_favorites); LCDML_add(109, LCDML_0_5, 3, "Favorites", UI_func_favorites);
LCDML_add(110, LCDML_0, 6, "Info", UI_func_information); LCDML_add(110, LCDML_0_5, 4, "Startup", UI_func_startup);
LCDML_addAdvanced(111, LCDML_0, 7, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); LCDML_add(111, LCDML_0, 6, "Info", UI_func_information);
#define _LCDML_DISP_cnt 111 LCDML_addAdvanced(112, LCDML_0, 7, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 112
#endif #endif

@ -106,7 +106,8 @@ LCDML_add(72, LCDML_0, 5, "System", NULL);
LCDML_add(73, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono); LCDML_add(73, LCDML_0_5, 1, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(74, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); LCDML_add(74, LCDML_0_5, 2, "MIDI Soft THRU", UI_func_midi_soft_thru);
LCDML_add(75, LCDML_0_5, 3, "Favorites", UI_func_favorites); LCDML_add(75, LCDML_0_5, 3, "Favorites", UI_func_favorites);
LCDML_add(76, LCDML_0, 6, "Info", UI_func_information); LCDML_add(76, LCDML_0_5, 4, "Startup", UI_func_startup);
LCDML_addAdvanced(77, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); LCDML_add(77, LCDML_0, 6, "Info", UI_func_information);
#define _LCDML_DISP_cnt 77 LCDML_addAdvanced(78, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 78
#endif #endif

@ -333,7 +333,7 @@
#define SAVE_SYS_MS 5000 #define SAVE_SYS_MS 5000
#define VOL_MAX_FLOAT 0.95 #define VOL_MAX_FLOAT 0.95
#define EEPROM_MARKER 0x4242 #define EEPROM_MARKER 0x4243
#ifndef NUM_DRUMS #ifndef NUM_DRUMS
#define NUM_DRUMS 0 #define NUM_DRUMS 0
@ -676,7 +676,11 @@
#define FAVORITES_NUM_MAX 100 #define FAVORITES_NUM_MAX 100
#define FAVORITES_NUM_DEFAULT 0 #define FAVORITES_NUM_DEFAULT 0
#define VOLUME_MULTIPLIER 1.3 #define STARTUP_NUM_MIN 0
#define STARTUP_NUM_MAX 255
#define STARTUP_NUM_DEFAULT 0
#define VOLUME_MULTIPLIER 1.4
// Buffer-size define for load/save configuration as JSON // Buffer-size define for load/save configuration as JSON
#define JSON_BUFFER_SIZE 8192 #define JSON_BUFFER_SIZE 8192
@ -755,6 +759,7 @@ typedef struct sys_s {
uint8_t soft_midi_thru; uint8_t soft_midi_thru;
uint8_t performance_number; uint8_t performance_number;
uint8_t favorites; uint8_t favorites;
uint8_t load_at_startup;
} sys_t; } sys_t;
typedef struct configuration_s { typedef struct configuration_s {

@ -999,9 +999,10 @@ bool load_sd_sys_json(void)
configuration.sys.soft_midi_thru = data_json["soft_midi_thru"]; configuration.sys.soft_midi_thru = data_json["soft_midi_thru"];
configuration.sys.performance_number = data_json["performance_number"]; configuration.sys.performance_number = data_json["performance_number"];
configuration.sys.favorites = data_json["favorites"]; configuration.sys.favorites = data_json["favorites"];
configuration.sys.load_at_startup = data_json["load_at_startup"];
check_configuration_sys(); check_configuration_sys();
//set_sys_params(); //TODO set_sys_params();
return (true); return (true);
} }
@ -1052,6 +1053,7 @@ bool save_sd_sys_json(void)
data_json["soft_midi_thru"] = configuration.sys.soft_midi_thru; data_json["soft_midi_thru"] = configuration.sys.soft_midi_thru;
data_json["performance_number"] = configuration.sys.performance_number; data_json["performance_number"] = configuration.sys.performance_number;
data_json["favorites"] = configuration.sys.favorites; data_json["favorites"] = configuration.sys.favorites;
data_json["load_at_startup"] = configuration.sys.load_at_startup;
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("Write JSON data:")); Serial.println(F("Write JSON data:"));

Loading…
Cancel
Save