diff --git a/MicroDexed.ino b/MicroDexed.ino index e7e7f6a..8f8a039 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -1315,11 +1315,11 @@ void initial_values_from_eeprom(bool init) #if defined(TEENSY_AUDIO_BOARD) // Special handling for SGTL5000 volume setting - uint8_t sgtl5000_level = EEPROM[4095]; - if (sgtl5000_level >= SGTL5000_LINEOUT_LEVEL_MIN || sgtl5000_level <= SGTL5000_LINEOUT_LEVEL_MAX) + uint8_t sgtl5000_level = EEPROM[EEPROM_SGTL5000_LINEOUT_LEVEL_ADDRESS]; + if (sgtl5000_level >= SGTL5000_LINEOUT_LEVEL_MAX || sgtl5000_level <= SGTL5000_LINEOUT_LEVEL_MIN) { sgtl5000_level = SGTL5000_LINEOUT_LEVEL_DEFAULT; - EEPROM[4095] = SGTL5000_LINEOUT_LEVEL_DEFAULT; + EEPROM[EEPROM_SGTL5000_LINEOUT_LEVEL_ADDRESS] = SGTL5000_LINEOUT_LEVEL_DEFAULT; } Serial.print(F("SGTL5000 output level: ")); Serial.println(sgtl5000_level); diff --git a/UI.hpp b/UI.hpp index 391d629..d01ba7c 100644 --- a/UI.hpp +++ b/UI.hpp @@ -2993,7 +2993,7 @@ void UI_func_output_level(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function - sgtl5000_level = EEPROM[4095]; + sgtl5000_level = EEPROM[EEPROM_SGTL5000_LINEOUT_LEVEL_ADDRESS]; lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Output Level", sgtl5000_level, SGTL5000_LINEOUT_LEVEL_MIN, SGTL5000_LINEOUT_LEVEL_MAX, 2, false, false, false, true); } @@ -3030,7 +3030,7 @@ void UI_func_output_level(uint8_t param) { // you can here reset some global vars or do nothing lcd_special_chars(SCROLLBAR); - EEPROM[4095] = sgtl5000_level; + EEPROM[EEPROM_SGTL5000_LINEOUT_LEVEL_ADDRESS] = sgtl5000_level; } } #endif diff --git a/config.h b/config.h index aded19c..8138304 100644 --- a/config.h +++ b/config.h @@ -221,6 +221,9 @@ // EEPROM address #define EEPROM_START_ADDRESS 100 +#if defined(TEENSY_AUDIO_BOARD) +#define EEPROM_SGTL5000_LINEOUT_LEVEL_ADDRESS 4095 +#endif #define MAX_BANKS 100 #define MAX_VOICES 32 // voices per bank