Fixing going menu backwards.

master
Holger Wirtz 6 years ago
parent a41fc72926
commit 6888d1c7f5
  1. 93
      UI.hpp

@ -848,7 +848,8 @@ void callback_velocity_sense_function()
void callback_effect_function() void callback_effect_function()
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("callback_effect_function")); Serial.print(F("callback_effect_function, focus position: "));
Serial.println(menu_position[EFFECTS]);
#endif #endif
menu_system.change_menu(effects_menu); menu_system.change_menu(effects_menu);
menu_system.set_focusPosition(Position::LEFT); menu_system.set_focusPosition(Position::LEFT);
@ -1229,32 +1230,36 @@ void encoder_switch_focus(uint8_t encoder_last, uint8_t encoder_value)
} }
} }
void goto_main_menu(void) void goto_main_menu(uint8_t menu_number)
{ {
menu_position[menu_number] = enc[RIGHT_ENCODER].read();
menu_system.change_menu(main_menu); menu_system.change_menu(main_menu);
menu_system.set_focusPosition(Position::LEFT); menu_system.set_focusPosition(Position::LEFT);
encoder_value[RIGHT_ENCODER] = menu_position[MAIN]; encoder_value[RIGHT_ENCODER] = menu_position[MAIN];
enc[RIGHT_ENCODER].write(menu_position[MAIN], 0, NUM_MAIN_MENUS - 1); enc[RIGHT_ENCODER].write(menu_position[MAIN], 0, NUM_MAIN_MENUS - 1);
} }
void goto_edit_sound_menu(void) void goto_edit_sound_menu(uint8_t menu_number)
{ {
menu_position[menu_number] = enc[RIGHT_ENCODER].read();
menu_system.change_menu(edit_sound_menu); menu_system.change_menu(edit_sound_menu);
menu_system.set_focusPosition(Position::LEFT); menu_system.set_focusPosition(Position::LEFT);
encoder_value[RIGHT_ENCODER] = menu_position[EDIT_SOUND]; encoder_value[RIGHT_ENCODER] = menu_position[EDIT_SOUND];
enc[RIGHT_ENCODER].write(menu_position[EDIT_SOUND], 0, NUM_EDIT_SOUND_MENUS - 1); enc[RIGHT_ENCODER].write(menu_position[EDIT_SOUND], 0, NUM_EDIT_SOUND_MENUS - 1);
} }
void goto_effects_menu(void) void goto_effects_menu(uint8_t menu_number)
{ {
menu_position[menu_number] = enc[RIGHT_ENCODER].read();
menu_system.change_menu(effects_menu); menu_system.change_menu(effects_menu);
menu_system.set_focusPosition(Position::LEFT); menu_system.set_focusPosition(Position::LEFT);
encoder_value[RIGHT_ENCODER] = menu_position[EFFECTS]; encoder_value[RIGHT_ENCODER] = menu_position[EFFECTS];
enc[RIGHT_ENCODER].write(menu_position[EFFECTS], 0, NUM_EFFECTS_MENUS - 1); enc[RIGHT_ENCODER].write(menu_position[EFFECTS], 0, NUM_EFFECTS_MENUS - 1);
} }
void goto_system_menu(void) void goto_system_menu(uint8_t menu_number)
{ {
menu_position[menu_number] = enc[RIGHT_ENCODER].read();
menu_system.change_menu(system_menu); menu_system.change_menu(system_menu);
menu_system.set_focusPosition(Position::LEFT); menu_system.set_focusPosition(Position::LEFT);
encoder_value[RIGHT_ENCODER] = menu_position[SYSTEM]; encoder_value[RIGHT_ENCODER] = menu_position[SYSTEM];
@ -2075,7 +2080,7 @@ void handle_ui(void)
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from master_volume to main")); Serial.println(F("from master_volume to main"));
#endif #endif
goto_main_menu(); goto_main_menu(MASTER_VOLUME);
} }
} }
@ -2527,14 +2532,14 @@ void handle_ui(void)
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from load_sound to main")); Serial.println(F("from load_sound to main"));
#endif #endif
goto_main_menu(); goto_main_menu(LOAD_SOUND);
} }
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 load_sound to main"));
#endif #endif
goto_main_menu(); goto_main_menu(EDIT_SOUND);
} }
else if (menu_system.get_currentScreen() == &decay_screen) // decay menu else if (menu_system.get_currentScreen() == &decay_screen) // decay menu
@ -2542,252 +2547,252 @@ void handle_ui(void)
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from decay to edit_sound")); Serial.println(F("from decay to edit_sound"));
#endif #endif
goto_edit_sound_menu(); goto_edit_sound_menu(DECAY);
} }
else if (menu_system.get_currentScreen() == &release_screen) // release menu else if (menu_system.get_currentScreen() == &release_screen) // release menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from release to edit_sound")); Serial.println(F("from release to edit_sound"));
#endif #endif
goto_edit_sound_menu(); goto_edit_sound_menu(RELEASE);
} }
else if (menu_system.get_currentScreen() == &hardness_screen) // hardness menu else if (menu_system.get_currentScreen() == &hardness_screen) // hardness menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from hardness to edit_sound")); Serial.println(F("from hardness to edit_sound"));
#endif #endif
goto_edit_sound_menu(); goto_edit_sound_menu(HARDNESS);
} }
else if (menu_system.get_currentScreen() == &treble_screen) // treble menu else if (menu_system.get_currentScreen() == &treble_screen) // treble menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from treble to edit_sound")); Serial.println(F("from treble to edit_sound"));
#endif #endif
goto_edit_sound_menu(); goto_edit_sound_menu(TREBLE);
} }
else if (menu_system.get_currentScreen() == &stereo_screen) // stereo menu else if (menu_system.get_currentScreen() == &stereo_screen) // stereo menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from stereo to edit_sound")); Serial.println(F("from stereo to edit_sound"));
#endif #endif
goto_edit_sound_menu(); goto_edit_sound_menu(STEREO_LEVEL);
} }
else if (menu_system.get_currentScreen() == &transpose_screen) // transpose menu else if (menu_system.get_currentScreen() == &transpose_screen) // transpose menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from transpose to edit_sound")); Serial.println(F("from transpose to edit_sound"));
#endif #endif
goto_edit_sound_menu(); goto_edit_sound_menu(TRANSPOSE);
} }
else if (menu_system.get_currentScreen() == &tune_screen) // tune menu else if (menu_system.get_currentScreen() == &tune_screen) // tune menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from tune to edit_sound")); Serial.println(F("from tune to edit_sound"));
#endif #endif
goto_edit_sound_menu(); goto_edit_sound_menu(TUNE);
} }
else if (menu_system.get_currentScreen() == &detune_screen) // detune menu else if (menu_system.get_currentScreen() == &detune_screen) // detune menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from detune to edit_sound")); Serial.println(F("from detune to edit_sound"));
#endif #endif
goto_edit_sound_menu(); goto_edit_sound_menu(DETUNE);
} }
else if (menu_system.get_currentScreen() == &velocity_sense_screen) // velocity_sense menu else if (menu_system.get_currentScreen() == &velocity_sense_screen) // velocity_sense menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from velocity_sense to edit_sound")); Serial.println(F("from velocity_sense to edit_sound"));
#endif #endif
goto_edit_sound_menu(); goto_edit_sound_menu(VELOCITY_SENSE);
} }
else if (menu_system.get_currentScreen() == &effects_screen) // effect menu else if (menu_system.get_currentScreen() == &effects_screen) // effect menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from effect to main")); Serial.println(F("from effect to main"));
#endif #endif
goto_main_menu(); goto_main_menu(EFFECTS);
} }
else if (menu_system.get_currentScreen() == &pan_trem_frequency_screen) //pan_trem_frequency menu else if (menu_system.get_currentScreen() == &pan_trem_frequency_screen) //pan_trem_frequency menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from pan_trem_frequency to effects")); Serial.println(F("from pan_trem_frequency to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(PAN_TREM_FREQUENCY);
} }
else if (menu_system.get_currentScreen() == &pan_trem_level_screen) // pan_trem_level menu else if (menu_system.get_currentScreen() == &pan_trem_level_screen) // pan_trem_level menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from pan_trem_level to effects")); Serial.println(F("from pan_trem_level to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(PAN_TREM_LEVEL);
} }
else if (menu_system.get_currentScreen() == &overdrive_screen) // overdrive menu else if (menu_system.get_currentScreen() == &overdrive_screen) // overdrive menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from overdrive to effects")); Serial.println(F("from overdrive to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(OVERDRIVE);
} }
else if (menu_system.get_currentScreen() == &comp_gain_screen) // comp_gain menu else if (menu_system.get_currentScreen() == &comp_gain_screen) // comp_gain menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from comp_gain to effects")); Serial.println(F("from comp_gain to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(COMP_GAIN);
} }
else if (menu_system.get_currentScreen() == &comp_response_screen) // comp_response menu else if (menu_system.get_currentScreen() == &comp_response_screen) // comp_response menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from comp_response to effects")); Serial.println(F("from comp_response to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(COMP_RESPONSE);
} }
else if (menu_system.get_currentScreen() == &comp_limit_screen) // comp_limit menu else if (menu_system.get_currentScreen() == &comp_limit_screen) // comp_limit menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from comp_limit to effects")); Serial.println(F("from comp_limit to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(COMP_LIMIT);
} }
else if (menu_system.get_currentScreen() == &comp_threshold_screen) // comp_threshold menu else if (menu_system.get_currentScreen() == &comp_threshold_screen) // comp_threshold menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from comp_threshold to effects")); Serial.println(F("from comp_threshold to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(COMP_THRESHOLD);
} }
else if (menu_system.get_currentScreen() == &comp_attack_screen) // comp_attack menu else if (menu_system.get_currentScreen() == &comp_attack_screen) // comp_attack menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from comp_attack to effects")); Serial.println(F("from comp_attack to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(COMP_ATTACK);
} }
else if (menu_system.get_currentScreen() == &comp_decay_screen) // comp_decay menu else if (menu_system.get_currentScreen() == &comp_decay_screen) // comp_decay menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from comp_decay to effects")); Serial.println(F("from comp_decay to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(COMP_DECAY);
} }
else if (menu_system.get_currentScreen() == &reverb_roomsize_screen) // reverb_roomsize menu else if (menu_system.get_currentScreen() == &reverb_roomsize_screen) // reverb_roomsize menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from reverb_roomsize to effects")); Serial.println(F("from reverb_roomsize to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(REV_ROOMSIZE);
} }
else if (menu_system.get_currentScreen() == &reverb_damping_screen) // reverb_damping menu else if (menu_system.get_currentScreen() == &reverb_damping_screen) // reverb_damping menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from reverb_damping to effects")); Serial.println(F("from reverb_damping to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(REV_DAMPING);
} }
else if (menu_system.get_currentScreen() == &reverb_level_screen) // reverb_level menu else if (menu_system.get_currentScreen() == &reverb_level_screen) // reverb_level menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from reverb_level to effects")); Serial.println(F("from reverb_level to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(REV_LEVEL);
} }
else if (menu_system.get_currentScreen() == &chorus_frequency_screen) // chorus_frequency menu else if (menu_system.get_currentScreen() == &chorus_frequency_screen) // chorus_frequency menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from chorus_frequency to effects")); Serial.println(F("from chorus_frequency to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(CHORUS_FREQ);
} }
else if (menu_system.get_currentScreen() == &chorus_delay_screen) // chorus_delay menu else if (menu_system.get_currentScreen() == &chorus_delay_screen) // chorus_delay menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from chorus_delay to effects")); Serial.println(F("from chorus_delay to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(CHORUS_DELAY);
} }
else if (menu_system.get_currentScreen() == &chorus_level_screen) // chorus_level menu else if (menu_system.get_currentScreen() == &chorus_level_screen) // chorus_level menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from chorus_level to effects")); Serial.println(F("from chorus_level to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(CHORUS_LEVEL);
} }
else if (menu_system.get_currentScreen() == &bass_lr_level_screen) // bass_lr_level menu else if (menu_system.get_currentScreen() == &bass_lr_level_screen) // bass_lr_level menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from bass_lr_level to effects")); Serial.println(F("from bass_lr_level to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(BASS_LR_LEVEL);
} }
else if (menu_system.get_currentScreen() == &bass_mono_level_screen) // bass_mono_level menu else if (menu_system.get_currentScreen() == &bass_mono_level_screen) // bass_mono_level menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from bass_mono_level to effects")); Serial.println(F("from bass_mono_level to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(BASS_MONO_LEVEL);
} }
else if (menu_system.get_currentScreen() == &eq_bass_screen) // eq_bass menu else if (menu_system.get_currentScreen() == &eq_bass_screen) // eq_bass menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from eq_bass to effects")); Serial.println(F("from eq_bass to effects"));
#endif #endif
goto_effects_menu(); goto_effects_menu(EQ_BASS);
} }
else if (menu_system.get_currentScreen() == &eq_treble_screen) // eq_treble menu else if (menu_system.get_currentScreen() == &eq_treble_screen) // eq_treble menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from eq_treble to main")); Serial.println(F("from eq_treble to main"));
#endif #endif
goto_effects_menu(); goto_effects_menu(EQ_TREBLE);
} }
else if (menu_system.get_currentScreen() == &save_sound_screen) // save_sound menu else if (menu_system.get_currentScreen() == &save_sound_screen) // save_sound menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from save_sound to main")); Serial.println(F("from save_sound to main"));
#endif #endif
goto_main_menu(); goto_main_menu(SAVE_SOUND);
} }
else if (menu_system.get_currentScreen() == &system_screen) // system menu else if (menu_system.get_currentScreen() == &system_screen) // system menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from system to main")); Serial.println(F("from system to main"));
#endif #endif
goto_main_menu(); goto_main_menu(SYSTEM);
} }
else if (menu_system.get_currentScreen() == &loudness_screen) // loudness menu else if (menu_system.get_currentScreen() == &loudness_screen) // loudness menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from loudness to system")); Serial.println(F("from loudness to system"));
#endif #endif
goto_system_menu(); goto_system_menu(LOUDNESS);
} }
else if (menu_system.get_currentScreen() == &midi_channel_screen) // midi_channel menu else if (menu_system.get_currentScreen() == &midi_channel_screen) // midi_channel menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from midi_channel to system")); Serial.println(F("from midi_channel to system"));
#endif #endif
goto_system_menu(); goto_system_menu(MIDI_CHANNEL);
} }
else if (menu_system.get_currentScreen() == &midi_soft_thru_screen) // midi_soft_thru menu else if (menu_system.get_currentScreen() == &midi_soft_thru_screen) // midi_soft_thru menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from midi_soft_thru to system")); Serial.println(F("from midi_soft_thru to system"));
#endif #endif
goto_system_menu(); goto_system_menu(MIDI_SOFT_THRU);
} }
else if (menu_system.get_currentScreen() == &max_poly_screen) // max_poly menu else if (menu_system.get_currentScreen() == &max_poly_screen) // max_poly menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from max_poly to system")); Serial.println(F("from max_poly to system"));
#endif #endif
goto_system_menu(); goto_system_menu(MAX_POLY);
} }
else if (menu_system.get_currentScreen() == &info_screen) // info menu else if (menu_system.get_currentScreen() == &info_screen) // info menu
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println(F("from info to main")); Serial.println(F("from info to main"));
#endif #endif
goto_main_menu(); goto_main_menu(INFO);
} }
} }
} }

Loading…
Cancel
Save