Better EEPROM handling added.

Fixing load/save functions.
pull/32/head
Holger Wirtz 5 years ago
parent 1b7f9725a5
commit 7c39166e2a
  1. 212
      MicroDexed.ino
  2. 303
      UI.hpp
  3. 20
      config.h
  4. 6
      dexed_sd.cpp
  5. 3
      dexed_sd.h

@ -200,12 +200,10 @@ char voice_name[NUM_DEXED][VOICE_NAME_LEN];
char bank_names[NUM_DEXED][MAX_BANKS][BANK_NAME_LEN];
char voice_names[NUM_DEXED][MAX_VOICES][VOICE_NAME_LEN];
uint8_t dexed_setup_number = 1;
elapsedMillis autostore;
uint8_t midi_timing_counter = 0; // 24 per qarter
elapsedMillis midi_timing_timestep;
uint16_t midi_timing_quarter = 0;
elapsedMillis long_button_pressed;
//elapsedMicros fill_audio_buffer;
elapsedMillis control_rate;
uint8_t active_voices[NUM_DEXED];
#ifdef SHOW_CPU_LOAD_MSEC
@ -217,7 +215,6 @@ uint32_t peak_dexed = 0;
float peak_dexed_value = 0.0;
uint32_t peak_r = 0;
uint32_t peak_l = 0;
bool eeprom_update_flag = false;
config_t configuration;
const uint8_t cs_pins[] = { SDCARD_TEENSY_CS_PIN, SDCARD_AUDIO_CS_PIN };
const uint8_t mosi_pins[] = { SDCARD_TEENSY_MOSI_PIN, SDCARD_AUDIO_MOSI_PIN };
@ -232,12 +229,12 @@ int16_t delayline_l[MOD_DELAY_SAMPLE_BUFFER];
#endif
#ifdef ENABLE_LCD_UI
/***********************************************************************
LCDMenuLib2
***********************************************************************/
extern LCDMenuLib2 LCDML;
#endif
/***********************************************************************
SETUP
***********************************************************************/
void setup()
{
// Start audio system
@ -606,12 +603,14 @@ void loop()
{
control_rate = 0;
/*
// EEPROM update handling
if (autostore >= AUTOSTORE_MS && eeprom_update_flag == true)
{
// only store configuration data to EEPROM when AUTOSTORE_MS is reached and no voices are activated anymore
eeprom_update_sys();
}
*/
// check for value changes, unused voices and CPU overload
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
@ -709,7 +708,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
if (inValue < MAX_BANKS - 1)
{
configuration.performance.bank[instance_id] = inValue;
eeprom_write();
//eeprom_write();
}
break;
case 1:
@ -737,7 +736,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
case 5: // Portamento time
configuration.dexed[instance_id].portamento_time = inValue;
MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time);
eeprom_write();
//eeprom_write();
break;
case 7: // Instance Volume
#ifdef DEBUG
@ -749,7 +748,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
#else
dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX));
#endif
eeprom_write();
//eeprom_write();
break;
case 10: // Pan
#ifdef DEBUG
@ -757,14 +756,14 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
#endif
configuration.dexed[instance_id].pan = map(inValue, 0, 0x7f, PANORAMA_MIN, PANORAMA_MAX);
mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0));
eeprom_write();
//eeprom_write();
break;
case 32: // BankSelect LSB
#ifdef DEBUG
Serial.println(F("BANK-SELECT CC"));
#endif
configuration.performance.bank[instance_id] = inValue;
eeprom_write();
//eeprom_write();
break;
case 64:
MicroDexed[instance_id]->setSustain(inValue > 63);
@ -782,37 +781,37 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
break;
case 65:
MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time);
eeprom_write();
//eeprom_write();
break;
#if defined(USE_FX)
case 103: // CC 103: filter resonance
configuration.dexed[instance_id].filter_resonance = map(inValue, 0, 0x7f, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX);
MicroDexed[instance_id]->fx.Reso = mapfloat(configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0);
eeprom_write();
//eeprom_write();
break;
case 104: // CC 104: filter cutoff
configuration.dexed[instance_id].filter_cutoff = map(inValue, 0, 0x7f, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX);
MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0);
eeprom_write();
//eeprom_write();
break;
case 105: // CC 105: delay time
configuration.fx.delay_time = map(inValue, 0, 0x7f, DELAY_TIME_MIN, DELAY_TIME_MAX);
delay_r.delay(0, configuration.fx.delay_time * 10);
delay_l.delay(0, configuration.fx.delay_time * 10);
eeprom_write();
//eeprom_write();
case 106: // CC 106: delay feedback
configuration.fx.delay_feedback = map(inValue, 0, 0x7f, DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX);
//delay_fb_mixer_r.gain(0, 1.0); // original signal
delay_fb_mixer_r.gain(1, mapfloat(configuration.fx.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback
//delay_fb_mixer_l.gain(0, 1.0); // original signal
delay_fb_mixer_l.gain(1, mapfloat(configuration.fx.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback
eeprom_write();
//eeprom_write();
break;
case 107: // CC 107: delay volume
configuration.dexed[instance_id].delay_send = map(inValue, 0, 0x7f, DELAY_SEND_MIN, DELAY_SEND_MAX);
master_mixer_r.gain(DELAY, mapfloat(configuration.fx.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0));
master_mixer_l.gain(DELAY, mapfloat(configuration.fx.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0));
eeprom_write();
//eeprom_write();
break;
#endif
case 120:
@ -826,11 +825,11 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue)
break;
case 126:
MicroDexed[instance_id]->setMonoMode(true);
eeprom_write();
//eeprom_write();
break;
case 127:
MicroDexed[instance_id]->setMonoMode(false);
eeprom_write();
//eeprom_write();
break;
}
}
@ -1256,6 +1255,18 @@ void set_volume(uint8_t v, uint8_t m)
void initial_values_from_eeprom(bool init)
{
uint32_t _m_ = 0x0000;
EEPROM.get(EEPROM_START_ADDRESS + offsetof(configuration_s, _marker_), _m_);
if (_m_ != EEPROM_MARKER)
{
#ifdef DEBUG
Serial.println(F("Found wrong EEPROM marker, initializing EEPROM..."));
#endif
init = true;
configuration._marker_ = EEPROM_MARKER;
}
if (init == true)
init_configuration();
else
@ -1267,10 +1278,11 @@ void initial_values_from_eeprom(bool init)
eeprom_get_sys();
eeprom_get_fx();
eeprom_get_performance();
for (uint8_t i = 0; i < NUM_DEXED; i++)
eeprom_get_dexed(i);
show_configuration();
check_configuration();
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
@ -1344,10 +1356,11 @@ void check_configuration(void)
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
configuration.dexed[instance_id].midi_channel = constrain(configuration.dexed[instance_id].midi_channel, MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX);
configuration.performance.bank[instance_id] = constrain(configuration.performance.bank[instance_id], 0, MAX_BANKS - 1);
configuration.performance.voice[instance_id] = constrain(configuration.performance.voice[instance_id], 0, MAX_VOICES - 1);
configuration.performance.voiceconfig_number[instance_id] = constrain(configuration.performance.voiceconfig_number[instance_id], VOICECONFIG_NUM_MIN, VOICECONFIG_NUM_MAX);
configuration.dexed[instance_id].midi_channel = constrain(configuration.dexed[instance_id].midi_channel, MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX);
configuration.dexed[instance_id].lowest_note = constrain(configuration.dexed[instance_id].lowest_note, INSTANCE_LOWEST_NOTE_MIN, INSTANCE_LOWEST_NOTE_MAX);
configuration.dexed[instance_id].highest_note = constrain(configuration.dexed[instance_id].highest_note, INSTANCE_HIGHEST_NOTE_MIN, INSTANCE_HIGHEST_NOTE_MAX);
configuration.dexed[instance_id].reverb_send = constrain(configuration.dexed[instance_id].reverb_send, REVERB_SEND_MIN, REVERB_SEND_MAX);
@ -1398,14 +1411,14 @@ void init_configuration(void)
Serial.println(F("INITIALIZING CONFIGURATION"));
#endif
configuration.sys.checksum = 0xffff;
//configuration.sys.checksum = 0xffff;
configuration.sys.instances = INSTANCES_DEFAULT;
configuration.sys.vol = VOLUME_DEFAULT;
configuration.sys.mono = MONO_DEFAULT;
configuration.sys.soft_midi_thru = SOFT_MIDI_THRU_DEFAULT;
configuration.sys.performance_number = PERFORMANCE_NUM_DEFAULT;
configuration.fx.checksum = 0xffff;
//configuration.fx.checksum = 0xffff;
configuration.fx.reverb_roomsize = REVERB_ROOMSIZE_DEFAULT;
configuration.fx.reverb_damping = REVERB_DAMPING_DEFAULT;
configuration.fx.reverb_level = REVERB_LEVEL_DEFAULT;
@ -1417,16 +1430,17 @@ void init_configuration(void)
configuration.fx.delay_feedback = DELAY_FEEDBACK_DEFAULT;
configuration.fx.delay_level = DELAY_LEVEL_DEFAULT;
configuration.performance.checksum = 0xffff;
//configuration.performance.checksum = 0xffff;
configuration.performance.fx_number = FX_NUM_DEFAULT;
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
configuration.dexed[instance_id].checksum = 0xffff;
configuration.dexed[instance_id].midi_channel = DEFAULT_MIDI_CHANNEL;
configuration.performance.bank[instance_id] = SYSEXBANK_DEFAULT;
configuration.performance.voice[instance_id] = SYSEXSOUND_DEFAULT;
configuration.performance.voiceconfig_number[instance_id] = VOICECONFIG_NUM_DEFAULT;
//configuration.dexed[instance_id].checksum = 0xffff;
configuration.dexed[instance_id].midi_channel = DEFAULT_MIDI_CHANNEL;
configuration.dexed[instance_id].lowest_note = INSTANCE_LOWEST_NOTE_MIN;
configuration.dexed[instance_id].highest_note = INSTANCE_HIGHEST_NOTE_MAX;
configuration.dexed[instance_id].reverb_send = REVERB_SEND_DEFAULT;
@ -1474,63 +1488,42 @@ void init_configuration(void)
}
set_volume(configuration.sys.vol, configuration.sys.mono);
eeprom_update_sys();
eeprom_update_fx();
eeprom_update_performance();
for (uint8_t i = 0; i < NUM_DEXED; i++)
eeprom_update_dexed(i);
eeprom_update();
}
void eeprom_write(void)
void eeprom_update(void)
{
autostore = 0;
eeprom_update_flag = true;
uint8_t* c = (uint8_t*)&configuration;
for (uint16_t i = 0; i < sizeof(configuration); i++)
EEPROM.update(EEPROM_START_ADDRESS + i, c[i]);
}
void eeprom_update_sys(void)
{
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
if (active_voices[instance_id] > 0)
autostore = 0;
else
{
eeprom_update_flag = false;
configuration.sys.checksum = crc32((byte*)&configuration.sys + 4, sizeof(configuration.sys) - 4);
EEPROM.put(EEPROM_SYS_START_ADDRESS, configuration.sys);
uint8_t* c = (uint8_t*)&configuration.sys;
for (uint16_t i = 0; i < sizeof(configuration.sys); i++)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, sys) + i, c[i]);
#ifdef DEBUG
Serial.println(F("Updating EEPROM sys."));
#endif
}
}
}
bool eeprom_get_sys(void)
{
EEPROM.get(EEPROM_SYS_START_ADDRESS, configuration.sys);
uint32_t checksum = crc32((byte*)&configuration.sys + 4, sizeof(configuration.sys) - 4);
if (checksum != configuration.sys.checksum)
{
#ifdef DEBUG
Serial.println(F("Checksum error reading EEPROM sys."));
#endif
return (false);
}
else
{
#ifdef DEBUG
Serial.print(F("EEPROM sys loaded."));
#endif
EEPROM.get(EEPROM_START_ADDRESS + offsetof(configuration_s, sys), configuration.sys);
return (true);
}
}
void eeprom_update_fx(void)
{
configuration.fx.checksum = crc32((byte*)&configuration.fx + 4, sizeof(configuration.fx) - 4);
EEPROM.put(EEPROM_FX_START_ADDRESS, configuration.fx);
uint8_t* c = (uint8_t*)&configuration.fx;
for (uint16_t i = 0; i < sizeof(configuration.fx); i++)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx) + i, c[i]);
#ifdef DEBUG
Serial.println(F("Updating EEPROM fx."));
#endif
@ -1538,29 +1531,34 @@ void eeprom_update_fx(void)
bool eeprom_get_fx(void)
{
EEPROM.get(EEPROM_FX_START_ADDRESS, configuration.fx);
uint32_t checksum = crc32((byte*)&configuration.fx + 4, sizeof(configuration.fx) - 4);
EEPROM.get(EEPROM_START_ADDRESS + offsetof(configuration_s, fx), configuration.fx);
return (true);
}
if (checksum != configuration.fx.checksum)
void eeprom_update_dexed(uint8_t instance_id)
{
#ifdef DEBUG
Serial.println(F("Checksum error reading EEPROM fx."));
#endif
return (false);
}
#if NUM_DEXED == 1
uint8_t* c = (uint8_t*)&configuration.dexed[0];
for (uint16_t i = 0; i < sizeof(configuration.dexed[0]); i++)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0]) + i, c[i]);
#else
uint8_t* c;
if (instance_id == 0)
c = (uint8_t*)&configuration.dexed[0];
else
c = (uint8_t*)&configuration.dexed[1];
for (uint16_t i = 0; i < sizeof(configuration.dexed[instance_id]); i++)
{
#ifdef DEBUG
Serial.print(F("EEPROM fx loaded."));
#endif
return (true);
}
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0]) + i, c[i]);
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1]) + i, c[i]);
}
#endif
void eeprom_update_dexed(uint8_t instance_id)
{
configuration.dexed[instance_id].checksum = crc32((byte*)&configuration.dexed[instance_id] + 4, sizeof(configuration.dexed[instance_id]) - 4);
EEPROM.put(EEPROM_DEXED_START_ADDRESS + instance_id * sizeof(dexed_t), configuration.dexed[instance_id]);
#ifdef DEBUG
Serial.print(F("Updating EEPROM dexed (instance "));
Serial.print(instance_id);
@ -1570,33 +1568,18 @@ void eeprom_update_dexed(uint8_t instance_id)
bool eeprom_get_dexed(uint8_t instance_id)
{
EEPROM.get(EEPROM_DEXED_START_ADDRESS + instance_id * sizeof(dexed_t), configuration.dexed[instance_id]);
uint32_t checksum = crc32((byte*)&configuration.dexed[instance_id] + 4, sizeof(configuration.dexed[instance_id]) - 4);
if (checksum != configuration.dexed[instance_id].checksum)
{
#ifdef DEBUG
Serial.print(F("Checksum error reading EEPROM dexed (instance "));
Serial.print(instance_id);
Serial.println(F(")"));
#endif
return (false);
}
else
{
#ifdef DEBUG
Serial.print(F("EEPROM dexed (instance "));
Serial.print(instance_id);
Serial.println(F(") loaded."));
#if NUM_DEXED>1
EEPROM.get(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1]), configuration.dexed[1]);
#else
EEPROM.get(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0]), configuration.dexed[0]);
#endif
return (true);
}
}
void eeprom_update_performance()
{
configuration.performance.checksum = crc32((byte*)&configuration.performance + 4, sizeof(configuration.performance) - 4);
EEPROM.put(EEPROM_PERFORMANCE_START_ADDRESS, configuration.performance);
//configuration.performance.checksum = crc32((byte*)&configuration.performance + 4, sizeof(configuration.performance) - 4);
EEPROM.put(EEPROM_START_ADDRESS + offsetof(configuration_s, performance), configuration.performance);
#ifdef DEBUG
Serial.println(F("Updating EEPROM performance."));
#endif
@ -1604,24 +1587,9 @@ void eeprom_update_performance()
bool eeprom_get_performance()
{
EEPROM.get(EEPROM_PERFORMANCE_START_ADDRESS, configuration.performance);
uint32_t checksum = crc32((byte*)&configuration.performance + 4, sizeof(configuration.performance) - 4);
if (checksum != configuration.performance.checksum)
{
#ifdef DEBUG
Serial.println(F("Checksum error reading EEPROM performance."));
#endif
return (false);
}
else
{
#ifdef DEBUG
Serial.println(F("EEPROM performance loaded."));
#endif
EEPROM.get(EEPROM_START_ADDRESS + offsetof(configuration_s, performance), configuration.performance);
return (true);
}
}
/******************************************************************************
HELPERS
@ -1868,13 +1836,13 @@ void show_configuration(void)
Serial.println();
Serial.println(F("CONFIGURATION:"));
Serial.println(F("System"));
Serial.print(F(" Checksum 0x")); Serial.println(configuration.sys.checksum, HEX);
//Serial.print(F(" Checksum 0x")); Serial.println(configuration.sys.checksum, HEX);
Serial.print(F(" Instances ")); Serial.println(configuration.sys.instances, DEC);
Serial.print(F(" Volume ")); Serial.println(configuration.sys.vol, DEC);
Serial.print(F(" Mono ")); Serial.println(configuration.sys.mono, DEC);
Serial.print(F(" Soft MIDI Thru ")); Serial.println(configuration.sys.soft_midi_thru, DEC);
Serial.println(F("FX"));
Serial.print(F(" Checksum 0x")); Serial.println(configuration.fx.checksum, HEX);
//Serial.print(F(" Checksum 0x")); Serial.println(configuration.fx.checksum, HEX);
Serial.print(F(" Reverb Roomsize ")); Serial.println(configuration.fx.reverb_roomsize, DEC);
Serial.print(F(" Reverb Damping ")); Serial.println(configuration.fx.reverb_damping, DEC);
Serial.print(F(" Reverb Level ")); Serial.println(configuration.fx.reverb_level, DEC);
@ -1890,10 +1858,8 @@ void show_configuration(void)
{
Serial.print(F("Dexed instance "));
Serial.println(instance_id, DEC);
Serial.print(F(" Checksum 0x")); Serial.println(configuration.dexed[instance_id].checksum, HEX);
//Serial.print(F(" Checksum 0x")); Serial.println(configuration.dexed[instance_id].checksum, HEX);
Serial.print(F(" MIDI-Channel ")); Serial.println(configuration.dexed[instance_id].midi_channel, DEC);
Serial.print(F(" Bank ")); Serial.println(configuration.performance.bank[instance_id], DEC);
Serial.print(F(" Voice ")); Serial.println(configuration.performance.voice[instance_id], DEC);
Serial.print(F(" Lowest Note ")); Serial.println(configuration.dexed[instance_id].lowest_note, DEC);
Serial.print(F(" Highest Note ")); Serial.println(configuration.dexed[instance_id].highest_note, DEC);
Serial.print(F(" Reverb Send ")); Serial.println(configuration.dexed[instance_id].reverb_send, DEC);
@ -1931,7 +1897,7 @@ void show_configuration(void)
}
Serial.println(F("Performance"));
Serial.print(F(" Checksum 0x")); Serial.println(configuration.performance.checksum, HEX);
//Serial.print(F(" Checksum 0x")); Serial.println(configuration.performance.checksum, HEX);
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
Serial.print(F(" Bank ")); Serial.print(instance_id, DEC); Serial.print(" "); Serial.println(configuration.performance.bank[instance_id], DEC);

303
UI.hpp

@ -54,12 +54,16 @@ extern char bank_name[NUM_DEXED][BANK_NAME_LEN];
extern char voice_name[NUM_DEXED][VOICE_NAME_LEN];
extern char voice_names[NUM_DEXED][MAX_VOICES][VOICE_NAME_LEN];
extern void strip_extension(char* s, char *target);
extern void eeprom_write(void);
//extern void eeprom_write(void);
extern bool get_voice_names_from_bank(uint8_t b, uint8_t instance_id);
extern bool load_sysex(uint8_t b, uint8_t v);
extern void generate_version_string(char* buffer, uint8_t len);
extern void initial_values_from_eeprom(bool init);
extern void _softRestart(void);
extern void eeprom_update_sys(void);
extern void eeprom_update_performance(void);
extern void eeprom_update_fx(void);
extern void eeprom_update_dexed(uint8_t instance_id);
#ifdef DISPLAY_LCD_SPI
extern void change_disp_sd(bool d);
@ -228,6 +232,7 @@ void lcd_display_bar_float(const char* title, float value, float factor, int32_t
void lcd_display_meter_int(const char* title, uint32_t value, float factor, float offset, int32_t min_value, int32_t max_value, uint8_t size, bool zeros, bool brackets, bool sign, bool init);
void lcd_display_meter_float(const char* title, float value, float factor, float offset, int32_t min_value, int32_t max_value, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign, bool init);
void lcd_special_chars(uint8_t mode);
void eeprom_update_var(uint16_t pos, uint8_t val, const char* val_string);
// normal menu
LCDMenuLib2_menu LCDML_0(255, 0, 0, NULL, NULL); // normal root menu element (do not change)
@ -473,7 +478,7 @@ void lcdml_menu_control(void)
encoderDir[ENC_L].reset();
encoderDir[ENC_R].reset();
eeprom_write();
//eeprom_write();
if (LCDML.MENU_getLastActivFunctionID() < 0xff)
LCDML.OTHER_jumpToID(LCDML.MENU_getLastActivFunctionID());
@ -849,6 +854,7 @@ void UI_func_reverb_roomsize(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.reverb_roomsize), configuration.fx.reverb_roomsize);
}
}
@ -882,6 +888,7 @@ void UI_func_reverb_damping(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.reverb_damping), configuration.fx.reverb_damping);
}
}
@ -920,6 +927,12 @@ void UI_func_reverb_send(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].reverb_send), configuration.dexed[0].reverb_send);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].reverb_send), configuration.dexed[1].reverb_send);
#endif
}
}
@ -953,6 +966,7 @@ void UI_func_reverb_level(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.reverb_level), configuration.fx.reverb_level);
}
}
@ -985,6 +999,7 @@ void UI_func_chorus_frequency(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_frequency), configuration.fx.chorus_frequency);
}
}
@ -1025,8 +1040,8 @@ void UI_func_chorus_waveform(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_waveform), configuration.fx.chorus_waveform);
}
}
@ -1059,6 +1074,7 @@ void UI_func_chorus_depth(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_depth), configuration.fx.chorus_depth);
}
}
@ -1097,6 +1113,12 @@ void UI_func_chorus_send(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].chorus_send), configuration.dexed[0].chorus_send);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].chorus_send), configuration.dexed[1].chorus_send);
#endif
}
}
@ -1130,6 +1152,7 @@ void UI_func_chorus_level(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.chorus_level), configuration.fx.chorus_level);
}
}
@ -1163,6 +1186,7 @@ void UI_func_delay_time(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.delay_time), configuration.fx.delay_time);
}
}
@ -1197,6 +1221,7 @@ void UI_func_delay_feedback(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.delay_feedback), configuration.fx.delay_feedback);
}
}
@ -1235,6 +1260,12 @@ void UI_func_delay_send(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].delay_send), configuration.dexed[0].delay_send);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].delay_send), configuration.dexed[1].delay_send);
#endif
}
}
@ -1268,6 +1299,7 @@ void UI_func_delay_level(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, fx.delay_level), configuration.fx.delay_level);
}
}
@ -1305,6 +1337,12 @@ void UI_func_filter_cutoff(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].filter_cutoff), configuration.dexed[0].filter_cutoff);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].filter_cutoff), configuration.dexed[1].filter_cutoff);
#endif
}
}
@ -1342,6 +1380,12 @@ void UI_func_filter_resonance(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].filter_resonance), configuration.dexed[0].filter_resonance);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].filter_resonance), configuration.dexed[1].filter_resonance);
#endif
}
}
#endif
@ -1381,6 +1425,12 @@ void UI_func_transpose(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].transpose), configuration.dexed[0].transpose);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].transpose), configuration.dexed[1].transpose);
#endif
}
}
@ -1419,6 +1469,12 @@ void UI_func_tune(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].tune), configuration.dexed[0].tune);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].tune), configuration.dexed[1].tune);
#endif
}
}
@ -1459,6 +1515,12 @@ void UI_func_midi_channel(uint8_t param)
{
// you can here reset some global vars or do nothing
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].midi_channel), configuration.dexed[0].midi_channel);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].midi_channel), configuration.dexed[1].midi_channel);
#endif
}
}
@ -1510,6 +1572,12 @@ void UI_func_lowest_note(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].lowest_note), configuration.dexed[0].lowest_note);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].lowest_note), configuration.dexed[1].lowest_note);
#endif
}
}
@ -1552,6 +1620,12 @@ void UI_func_highest_note(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].highest_note), configuration.dexed[0].highest_note);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].highest_note), configuration.dexed[1].highest_note);
#endif
}
}
@ -1590,6 +1664,12 @@ void UI_func_sound_intensity(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].sound_intensity), configuration.dexed[0].sound_intensity);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].sound_intensity), configuration.dexed[1].sound_intensity);
#endif
}
}
@ -1634,6 +1714,12 @@ void UI_func_panorama(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].pan), configuration.dexed[0].pan);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].pan), configuration.dexed[1].pan);
#endif
}
}
@ -1699,8 +1785,8 @@ void UI_func_stereo_mono(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
eeprom_write();
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, sys.vol), configuration.sys.vol);
}
}
@ -1738,6 +1824,12 @@ void UI_func_polyphony(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].polyphony), configuration.dexed[0].polyphony);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].polyphony), configuration.dexed[1].polyphony);
#endif
}
}
@ -1786,6 +1878,12 @@ void UI_func_engine(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].engine), configuration.dexed[0].engine);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].engine), configuration.dexed[1].engine);
#endif
}
}
@ -1831,6 +1929,12 @@ void UI_func_mono_poly(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].monopoly), configuration.dexed[0].monopoly);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].monopoly), configuration.dexed[1].monopoly);
#endif
}
}
@ -1876,6 +1980,12 @@ void UI_func_note_refresh(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].note_refresh), configuration.dexed[0].note_refresh);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].note_refresh), configuration.dexed[1].note_refresh);
#endif
}
}
@ -1913,6 +2023,12 @@ void UI_func_pb_range(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].pb_range), configuration.dexed[0].pb_range);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].pb_range), configuration.dexed[1].pb_range);
#endif
}
}
@ -1950,6 +2066,12 @@ void UI_func_pb_step(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].pb_step), configuration.dexed[0].pb_step);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].pb_step), configuration.dexed[1].pb_step);
#endif
}
}
@ -1987,6 +2109,12 @@ void UI_func_mw_range(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].mw_range), configuration.dexed[0].mw_range);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].mw_range), configuration.dexed[1].mw_range);
#endif
}
}
@ -2050,6 +2178,12 @@ void UI_func_mw_assign(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].mw_assign), configuration.dexed[0].mw_assign);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].mw_assign), configuration.dexed[1].mw_assign);
#endif
}
}
@ -2099,6 +2233,12 @@ void UI_func_mw_mode(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].mw_mode), configuration.dexed[0].mw_mode);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].mw_mode), configuration.dexed[1].mw_mode);
#endif
}
}
@ -2134,9 +2274,14 @@ void UI_func_fc_range(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].fc_range), configuration.dexed[0].fc_range);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].fc_range), configuration.dexed[1].fc_range);
#endif
}
}
@ -2200,6 +2345,12 @@ void UI_func_fc_assign(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].fc_assign), configuration.dexed[0].fc_assign);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].fc_assign), configuration.dexed[1].fc_assign);
#endif
}
}
@ -2249,6 +2400,12 @@ void UI_func_fc_mode(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].fc_mode), configuration.dexed[0].fc_mode);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].fc_mode), configuration.dexed[1].fc_mode);
#endif
}
}
@ -2286,6 +2443,12 @@ void UI_func_bc_range(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].bc_range), configuration.dexed[0].bc_range);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].bc_range), configuration.dexed[1].bc_range);
#endif
}
}
@ -2349,6 +2512,12 @@ void UI_func_bc_assign(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].bc_assign), configuration.dexed[0].bc_assign);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].bc_assign), configuration.dexed[1].bc_assign);
#endif
}
}
@ -2398,6 +2567,12 @@ void UI_func_bc_mode(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].bc_mode), configuration.dexed[0].bc_mode);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].bc_mode), configuration.dexed[1].bc_mode);
#endif
}
}
@ -2435,6 +2610,12 @@ void UI_func_at_range(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].at_range), configuration.dexed[0].at_range);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].at_range), configuration.dexed[1].at_range);
#endif
}
}
@ -2498,6 +2679,12 @@ void UI_func_at_assign(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].at_assign), configuration.dexed[0].at_assign);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].at_assign), configuration.dexed[1].at_assign);
#endif
}
}
@ -2547,6 +2734,12 @@ void UI_func_at_mode(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].at_mode), configuration.dexed[0].at_mode);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].at_mode), configuration.dexed[1].at_mode);
#endif
}
}
@ -2598,6 +2791,12 @@ void UI_func_portamento_mode(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].portamento_mode), configuration.dexed[0].portamento_mode);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].portamento_mode), configuration.dexed[1].portamento_mode);
#endif
}
}
@ -2643,6 +2842,12 @@ void UI_func_portamento_glissando(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].portamento_glissando), configuration.dexed[0].portamento_glissando);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].portamento_glissando), configuration.dexed[1].portamento_glissando);
#endif
}
}
@ -2680,6 +2885,12 @@ void UI_func_portamento_time(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].portamento_time), configuration.dexed[0].portamento_time);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].portamento_time), configuration.dexed[1].portamento_time);
#endif
}
}
@ -2797,6 +3008,12 @@ void UI_handle_OP(uint8_t param, uint8_t op, uint8_t instance_id)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].op_enabled), configuration.dexed[0].op_enabled);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].op_enabled), configuration.dexed[1].op_enabled);
#endif
}
}
@ -2861,8 +3078,9 @@ void UI_func_midi_soft_thru(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
eeprom_write();
//eeprom_write();
encoderDir[ENC_R].reset();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, sys.soft_midi_thru), configuration.sys.soft_midi_thru);
}
}
@ -2896,9 +3114,14 @@ void UI_func_velocity_level(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
// you can here reset some global vars or do nothing
lcd_special_chars(SCROLLBAR);
encoderDir[ENC_R].reset();
if (instance_id == 0)
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[0].velocity_level), configuration.dexed[0].velocity_level);
#if NUM_DEXED > 1
else
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, dexed[1].velocity_level), configuration.dexed[1].velocity_level);
#endif
}
}
@ -2963,6 +3186,8 @@ void UI_func_eeprom_reset(uint8_t param)
}
}
extern void show_configuration(void); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void UI_func_voice_select(uint8_t param)
{
uint8_t instance_id = 0;
@ -3020,7 +3245,7 @@ void UI_func_voice_select(uint8_t param)
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
eeprom_write();
//eeprom_write();
break;
case MENU_VOICE_SOUND:
voice_tmp = configuration.performance.voice[instance_id] - ENCODER[ENC_R].speed();
@ -3045,7 +3270,7 @@ void UI_func_voice_select(uint8_t param)
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
eeprom_write();
//eeprom_write();
break;
}
else if (LCDML.BT_checkDown())
@ -3063,7 +3288,7 @@ void UI_func_voice_select(uint8_t param)
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
eeprom_write();
//eeprom_write();
break;
case MENU_VOICE_SOUND:
voice_tmp = configuration.performance.voice[instance_id] + ENCODER[ENC_R].speed();
@ -3087,7 +3312,7 @@ void UI_func_voice_select(uint8_t param)
#ifdef DISPLAY_LCD_SPI
change_disp_sd(true);
#endif
eeprom_write();
//eeprom_write();
break;
}
@ -3123,12 +3348,28 @@ void UI_func_voice_select(uint8_t param)
break;
}
}
}
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
eeprom_write();
//eeprom_write();
encoderDir[ENC_R].reset();
if (instance_id == 0)
{
eeprom_update_var(offsetof(configuration_s, performance.voice[0]), configuration.performance.voice[0], "configuration.performance.voice[0]");
eeprom_update_var(offsetof(configuration_s, performance.bank[0]), configuration.performance.bank[0], "configuration.performance.bank[0]");
show_configuration();
//EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, performance.voice[0]), configuration.performance.voice[0]);
//EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, performance.bank[0]), configuration.performance.bank[0]);
}
#if NUM_DEXED > 1
else
{
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, performance.voice[1]), configuration.performance.voice[1]);
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, performance.bank[1]), configuration.performance.bank[1]);
}
#endif
}
}
@ -3168,7 +3409,8 @@ void UI_func_volume(uint8_t param)
{
lcd_special_chars(SCROLLBAR);
eeprom_write();
//eeprom_write();
EEPROM.update(EEPROM_START_ADDRESS + offsetof(configuration_s, sys.vol), configuration.sys.vol);
encoderDir[ENC_L].reset();
}
}
@ -3212,7 +3454,7 @@ void UI_func_load_performance(uint8_t param)
{
mode = 0xff;
eeprom_write();
//eeprom_write();
lcd.setCursor(0, 1);
if (load_sd_performance(configuration.sys.performance_number) == false)
lcd.print("Does not exist.");
@ -3246,6 +3488,8 @@ void UI_func_load_performance(uint8_t param)
lcd.print("Canceled ");
delay(500);
}
else
eeprom_update_performance();
encoderDir[ENC_R].reset();
}
@ -3313,7 +3557,7 @@ void UI_func_save_performance(uint8_t param)
else
{
mode = 0xff;
eeprom_write();
//eeprom_write();
if (overwrite == false || yesno == true)
{
save_sd_performance(configuration.performance.fx_number);
@ -3472,6 +3716,8 @@ void UI_func_load_voiceconfig(uint8_t param)
lcd.print("Canceled ");
delay(500);
}
else
eeprom_update_dexed(instance_id);
encoderDir[ENC_R].reset();
}
@ -3556,7 +3802,7 @@ void UI_func_save_voiceconfig(uint8_t param)
else
{
mode = 0xff;
eeprom_write();
//eeprom_write();
if (overwrite == false || yesno == true)
{
save_sd_voiceconfig(configuration.performance.voiceconfig_number[instance_id], instance_id);
@ -3659,7 +3905,7 @@ void UI_func_load_fx(uint8_t param)
else if (LCDML.BT_checkEnter())
{
mode = 0xff;
eeprom_write();
//eeprom_write();
if (load_sd_fx(configuration.performance.fx_number) == false)
lcd.print("Does not exist.");
@ -3693,6 +3939,8 @@ void UI_func_load_fx(uint8_t param)
lcd.print("Canceled ");
delay(500);
}
else
eeprom_update_fx();
encoderDir[ENC_R].reset();
}
@ -3760,7 +4008,7 @@ void UI_func_save_fx(uint8_t param)
else
{
mode = 0xff;
eeprom_write();
//eeprom_write();
if (overwrite == false || yesno == true)
{
save_sd_fx(configuration.performance.fx_number);
@ -3899,7 +4147,7 @@ void UI_func_sysex_receive_bank(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
eeprom_write();
//eeprom_write();
encoderDir[ENC_R].reset();
}
}
@ -3933,7 +4181,7 @@ void UI_func_sysex_send_bank(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
eeprom_write();
//eeprom_write();
encoderDir[ENC_R].reset();
}
}
@ -3967,7 +4215,7 @@ void UI_func_sysex_send_voice(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
eeprom_write();
//eeprom_write();
encoderDir[ENC_R].reset();
}
}
@ -4001,7 +4249,7 @@ void UI_func_sysex_receive_voice(uint8_t param)
if (LCDML.FUNC_close()) // ****** STABLE END *********
{
eeprom_write();
//eeprom_write();
encoderDir[ENC_R].reset();
}
}
@ -4263,5 +4511,16 @@ void lcd_special_chars(uint8_t mode)
break;
}
}
void eeprom_update_var(uint16_t pos, uint8_t val, const char* val_string)
{
#ifdef DEBUG
char tmp[80];
sprintf(tmp, "EEPROM update '%s' at position %d with value %d.", val_string, pos, val);
Serial.println(tmp);
#endif
EEPROM.update(EEPROM_START_ADDRESS + pos, val);
}
#endif
#endif

@ -242,10 +242,7 @@ enum { DEXED, CHORUS, DELAY, REVERB};
#define CONTROL_RATE_MS 100
#define EEPROM_SYS_START_ADDRESS EEPROM_START_ADDRESS
#define EEPROM_FX_START_ADDRESS EEPROM_START_ADDRESS + sizeof(configuration.sys)
#define EEPROM_DEXED_START_ADDRESS EEPROM_START_ADDRESS + sizeof(configuration.sys) + sizeof(configuration.fx)
#define EEPROM_PERFORMANCE_START_ADDRESS EEPROM_START_ADDRESS + sizeof(configuration.sys) + sizeof(configuration.fx) + NUM_DEXED * sizeof(configuration.dexed)
#define EEPROM_MARKER 0x4242
// MIDI
#ifdef MIDI_DEVICE_USB
@ -524,8 +521,7 @@ enum { DEXED, CHORUS, DELAY, REVERB};
#define VOICECONFIG_NUM_DEFAULT 0
//
typedef struct {
uint32_t checksum;
typedef struct dexed_s {
uint8_t lowest_note;
uint8_t highest_note;
uint8_t reverb_send;
@ -563,8 +559,7 @@ typedef struct {
uint8_t midi_channel;
} dexed_t;
typedef struct {
uint32_t checksum;
typedef struct fx_s {
uint8_t reverb_roomsize;
uint8_t reverb_damping;
uint8_t reverb_level;
@ -577,16 +572,14 @@ typedef struct {
uint8_t delay_level;
} fx_t;
typedef struct {
uint32_t checksum;
typedef struct performance_s {
uint8_t bank[NUM_DEXED];
uint8_t voice[NUM_DEXED];
uint8_t voiceconfig_number[NUM_DEXED];
uint8_t fx_number;
} performance_t;
typedef struct {
uint32_t checksum;
typedef struct sys_s {
uint8_t instances;
uint8_t vol;
uint8_t mono;
@ -594,11 +587,12 @@ typedef struct {
uint8_t performance_number;
} sys_t;
typedef struct {
typedef struct configuration_s {
sys_t sys;
fx_t fx;
performance_t performance;
dexed_t dexed[NUM_DEXED];
uint32_t _marker_;
} config_t;
#if !defined(_MAPFLOAT)

@ -200,7 +200,7 @@ bool load_sd_voiceconfig(uint8_t vc, uint8_t instance_id)
if (sysex)
{
get_sd_data(sysex, 0x42, (uint8_t*)&configuration.dexed[instance_id]);
configuration.dexed[instance_id].checksum = crc32((uint8_t*)&configuration.dexed[instance_id] + 4, sizeof(configuration.dexed[instance_id]) - 4);
eeprom_update_dexed(instance_id);
return (true);
}
#ifdef DEBUG
@ -297,7 +297,7 @@ bool load_sd_fx(uint8_t fx)
if (sysex)
{
get_sd_data(sysex, 0x43, (uint8_t*)&configuration.fx);
configuration.fx.checksum = crc32((uint8_t*)&configuration.fx + 4, sizeof(configuration.fx) - 4);
eeprom_update_fx();
return (true);
}
#ifdef DEBUG
@ -392,7 +392,7 @@ bool load_sd_performance(uint8_t p)
if (sysex)
{
get_sd_data(sysex, 0x44, (uint8_t*)&configuration.performance);
configuration.performance.checksum = crc32((uint8_t*)&configuration.performance + 4, sizeof(configuration.performance) - 4);
eeprom_update_performance();
return (true);
}
#ifdef DEBUG

@ -44,6 +44,9 @@ extern uint8_t ui_state;
extern uint8_t ui_main_state;
extern config_t configuration;
extern uint32_t crc32(byte * calc_start, uint16_t calc_bytes);
extern void eeprom_update_dexed(uint8_t instance_id);
extern void eeprom_update_performance(void);
extern void eeprom_update_fx(void);
bool load_sd_voice(uint8_t b, uint8_t v, uint8_t instance_id);
bool get_sd_voice(File sysex, uint8_t voice_number, uint8_t* data);

Loading…
Cancel
Save