diff --git a/UI.hpp b/UI.hpp index 82a3883..3061c47 100644 --- a/UI.hpp +++ b/UI.hpp @@ -90,6 +90,9 @@ int8_t menu_position[NUM_MENUS]; #define RIGHT_ENCODER 1 extern void set_master_volume(uint8_t value); +extern void config_from_eeprom(void); +extern void eeprom_config_write(uint8_t value); + extern AudioControlSGTL5000 sgtl5000_1; extern AudioEffectFreeverb freeverb_r; extern AudioEffectFreeverb freeverb_l; @@ -97,7 +100,6 @@ extern AudioMixer4 mixer_r; extern AudioMixer4 mixer_l; extern AudioAmplifier volume_r; extern AudioAmplifier volume_l; -extern void eeprom_config_write(uint8_t value); extern mdaEPiano* ep; extern float _loudness; extern config_t configuration; @@ -1657,23 +1659,22 @@ void init_menus(void) encoder_value[RIGHT_ENCODER] = 0; } -void load_sound(uint8_t value) +void load_sound(void) { - sound = value; #ifdef DEBUG Serial.print(F("Load sound ")); - Serial.println(value); + Serial.println(sound); #endif - ; + config_from_eeprom(); } -void save_sound(uint8_t value) +void save_sound(void) { #ifdef DEBUG Serial.print(F("Save sound ")); - Serial.println(value); + Serial.println(sound); #endif - eeprom_config_write(value); + eeprom_config_write(sound); } void set_decay(uint8_t value) @@ -2102,7 +2103,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - load_sound(encoder_tmp); + sound=encoder_tmp; menu_system.update(); } } @@ -2363,7 +2364,7 @@ void handle_ui(void) if (encoder_tmp != encoder_value[RIGHT_ENCODER]) { // value up/down - save_sound(encoder_tmp); + sound=encoder_tmp; menu_system.update(); } } @@ -2441,18 +2442,18 @@ void handle_ui(void) // load sound #ifdef DEBUG Serial.print("Load sound "); - Serial.println(sound); + Serial.println(); #endif - load_sound(sound); + load_sound(); } else if (menu_system.get_currentScreen() == &save_sound_screen) { // save sound #ifdef DEBUG Serial.print("Save sound "); - Serial.println(sound); + Serial.println(); #endif - save_sound(sound); + save_sound(); } else { @@ -2540,7 +2541,7 @@ void handle_ui(void) else if (menu_system.get_currentScreen() == &edit_sound_screen) // sound menu { #ifdef DEBUG - Serial.println(F("from load_sound to main")); + Serial.println(F("from edit_sound to main")); #endif goto_main_menu(EDIT_SOUND);