master
Holger Wirtz 6 years ago
parent 1853fc91b9
commit 054b1f0e5b
  1. 31
      UI.hpp

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

Loading…
Cancel
Save