diff --git a/MicroDexed.ino b/MicroDexed.ino index ba077d9..b3c8f70 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -1452,13 +1452,21 @@ void eeprom_write(void) void eeprom_update(void) { - eeprom_update_flag = false; - configuration.checksum = crc32((byte*)&configuration + 4, sizeof(configuration) - 4); - EEPROM.put(EEPROM_START_ADDRESS, configuration); - Serial.println(F("Updating EEPROM")); + 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.checksum = crc32((byte*)&configuration + 4, sizeof(configuration) - 4); + EEPROM.put(EEPROM_START_ADDRESS, configuration); + Serial.println(F("Updating EEPROM")); #ifdef DEBUG - show_configuration(); + show_configuration(); #endif + } + } } uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc diff --git a/UI.hpp b/UI.hpp index 2076ee0..4889b19 100644 --- a/UI.hpp +++ b/UI.hpp @@ -789,11 +789,6 @@ void UI_func_reverb_roomsize(uint8_t param) // setup function lcd.setCursor(0, 0); lcd.print(F("Reverb Roomsize")); -#ifdef DEBUG - Serial.println(F("Entering UI_func_reverb_roomsize()")); - Serial.print(F("configuration.roomsize=")); - Serial.println(configuration.reverb_roomsize, DEC); -#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -829,11 +824,6 @@ void UI_func_reverb_roomsize(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { -#ifdef DEBUG - Serial.println(F("Leaving UI_func_reverb_roomsize()")); - Serial.print(F("reverb_roomsize=")); - Serial.println(configuration.reverb_roomsize, DEC); -#endif eeprom_write(); } } @@ -845,11 +835,6 @@ void UI_func_reverb_damping(uint8_t param) // setup function lcd.setCursor(0, 0); lcd.print(F("Reverb Damping")); -#ifdef DEBUG - Serial.println(F("Entering UI_func_reverb_damping()")); - Serial.print(F("reverb_damping=")); - Serial.println(configuration.reverb_damping, DEC); -#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -885,11 +870,6 @@ void UI_func_reverb_damping(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { -#ifdef DEBUG - Serial.println(F("Leaving UI_func_reverb_damping()")); - Serial.print(F("configuration.reverb_damping=")); - Serial.println(configuration.reverb_damping, DEC); -#endif eeprom_write(); } } @@ -906,13 +886,6 @@ void UI_func_reverb_send(uint8_t param) // setup function lcd.setCursor(0, 0); lcd.print(F("Reverb Send")); -#ifdef DEBUG - Serial.println(F("Entering UI_func_reverb_send()")); - Serial.print(F("configuration.dexed[")); - Serial.print(instance_id, DEC); - Serial.print(F("].reverb_send=")); - Serial.println(configuration.dexed[instance_id].reverb_send, DEC); -#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -949,13 +922,6 @@ void UI_func_reverb_send(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { -#ifdef DEBUG - Serial.println(F("Leaving UI_func_reverb_send()")); - Serial.print(F("configuration.dexed[")); - Serial.print(instance_id, DEC); - Serial.print(F("].reverb_send=")); - Serial.println(configuration.dexed[instance_id].reverb_send, DEC); -#endif eeprom_write(); } } @@ -967,11 +933,6 @@ void UI_func_reverb_level(uint8_t param) // setup function lcd.setCursor(0, 0); lcd.print(F("Reverb Level")); -#ifdef DEBUG - Serial.println(F("Entering UI_func_reverb_level()")); - Serial.print(F("reverb_level=")); - Serial.println(configuration.reverb_level, DEC); -#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -1007,11 +968,6 @@ void UI_func_reverb_level(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { -#ifdef DEBUG - Serial.println(F("Leaving UI_func_reverb_level()")); - Serial.print(F("configuration.reverb_levelg=")); - Serial.println(configuration.reverb_level, DEC); -#endif eeprom_write(); } } @@ -1023,11 +979,6 @@ void UI_func_chorus_frequency(uint8_t param) // setup function lcd.setCursor(0, 0); lcd.print(F("Chorus Frequency")); -#ifdef DEBUG - Serial.println(F("Entering UI_func_chorus_frequency()")); - Serial.print(F("configuration.chorus_frequency=")); - Serial.println(configuration.chorus_frequency, DEC); -#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -1063,11 +1014,6 @@ void UI_func_chorus_frequency(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { -#ifdef DEBUG - Serial.println(F("Leaving UI_func_chorus_frequency()")); - Serial.print(F("configuration.chorus_frequency=")); - Serial.println(configuration.chorus_frequency, DEC); -#endif eeprom_write(); } } @@ -1232,11 +1178,6 @@ void UI_func_chorus_level(uint8_t param) // setup function lcd.setCursor(0, 0); lcd.print(F("Chorus Level")); -#ifdef DEBUG - Serial.println(F("Entering UI_func_chorus_level()")); - Serial.print(F("chorus_level=")); - Serial.println(configuration.chorus_level, DEC); -#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -1272,11 +1213,6 @@ void UI_func_chorus_level(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { -#ifdef DEBUG - Serial.println(F("Leaving UI_func_chorus_level()")); - Serial.print(F("configuration.chorus_level=")); - Serial.println(configuration.chorus_level, DEC); -#endif eeprom_write(); } } @@ -1436,11 +1372,6 @@ void UI_func_delay_level(uint8_t param) // setup function lcd.setCursor(0, 0); lcd.print(F("Delay Level")); -#ifdef DEBUG - Serial.println(F("Entering UI_func_delay_level()")); - Serial.print(F("delay_level=")); - Serial.println(configuration.delay_level, DEC); -#endif } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -1476,11 +1407,6 @@ void UI_func_delay_level(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { -#ifdef DEBUG - Serial.println(F("Leaving UI_func_delay_level()")); - Serial.print(F("configuration.delay_levelg=")); - Serial.println(configuration.delay_level, DEC); -#endif eeprom_write(); } } @@ -3379,15 +3305,10 @@ void lcd_display_bar_int(const char* title, uint32_t value, uint32_t min_value, uint8_t vf = uint8_t(modff(_v, &_vi) * 10.0 + 0.5); uint8_t vi = uint8_t(_vi + 0.5); - Serial.println(value, DEC); - Serial.println(_v, 5); - Serial.println(vf, DEC); - Serial.println(vi, DEC); - if (init == true) { // show initial title, value and bar - lcd.clear(); + LCDML.DISP_clear(); lcd.show(0, 0, LCD_cols - 1, title); lcd.setCursor(LCD_cols - (size + 1) + 1, 0); lcd_display_int(value, size, zeros, brackets, sign); diff --git a/config.h b/config.h index 6d23c94..7dda6b1 100644 --- a/config.h +++ b/config.h @@ -244,6 +244,8 @@ enum { DEXED, CHORUS, DELAY, REVERB}; #endif #define TRANSPOSE_FIX 24 +//#define VOICE_SILENCE_LEVEL 1069 +#define VOICE_SILENCE_LEVEL 4000 // Audio #ifdef TGA_AUDIO_BOARD diff --git a/dexed.cpp b/dexed.cpp index 187dfdb..4c50a0b 100644 --- a/dexed.cpp +++ b/dexed.cpp @@ -444,7 +444,7 @@ uint8_t Dexed::getNumNotesPlaying(void) { // this voice is a carrier! op_carrier_num++; - if (voiceStatus.amp[op] <= 1069 && voiceStatus.ampStep[op] == 4) + if (voiceStatus.amp[op] <= VOICE_SILENCE_LEVEL && voiceStatus.ampStep[op] == 4) { // this voice produces no audio output op_amp++;