From 9f520a81d2b0dac3cc646f31240445f949b546d0 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Fri, 24 May 2019 08:50:06 +0200 Subject: [PATCH] Fix for menu selection. --- UI.hpp | 87 ++++++++++++++++++++++++++++---------------------------- config.h | 2 +- 2 files changed, 45 insertions(+), 44 deletions(-) diff --git a/UI.hpp b/UI.hpp index 3061c47..472bfca 100644 --- a/UI.hpp +++ b/UI.hpp @@ -17,7 +17,7 @@ const uint8_t MAX_SCREENS = 14; ///< @note Default: 14 /// Configures the number of available menus per menus system. - const uint8_t MAX_MENUS = 41; ///< @note Default: 8 + const uint8_t MAX_MENUS = 40; ///< @note Default: 8 */ @@ -36,7 +36,7 @@ int32_t encoder_value[NUM_ENCODER]; Bounce but[NUM_ENCODER] = {Bounce(BUT_L_PIN, BUT_DEBOUNCE_MS), Bounce(BUT_R_PIN, BUT_DEBOUNCE_MS)}; elapsedMillis back_to_main; -#define NUM_MENUS 41 +#define NUM_MENUS 40 #define MAIN 0 /*************************************/ @@ -700,7 +700,7 @@ LiquidSystem menu_system; /****************************************** LOAD SOUND CALLBACKS ******************************************/ -void callback_load_sound_function() { +void callback_load_sound_function(void) { #ifdef DEBUG Serial.println(F("callback_load_sound_function")); #endif @@ -714,7 +714,7 @@ void callback_load_sound_function() { /****************************************** EDIT SOUND CALLBACKS ******************************************/ -void callback_edit_sound_function() +void callback_edit_sound_function(void) { #ifdef DEBUG Serial.println(F("callback_edit_sound_function")); @@ -737,7 +737,7 @@ void callback_edit_sound_function() menu_system.update(); } -void callback_decay_function() +void callback_decay_function(void) { #ifdef DEBUG Serial.println(F("callback_decay_function")); @@ -749,7 +749,7 @@ void callback_decay_function() menu_system.update(); } -void callback_release_function() +void callback_release_function(void) { #ifdef DEBUG Serial.println(F("callback_release_function")); @@ -761,7 +761,7 @@ void callback_release_function() menu_system.update(); } -void callback_hardness_function() +void callback_hardness_function(void) { #ifdef DEBUG Serial.println(F("callback_hardness_function")); @@ -773,7 +773,7 @@ void callback_hardness_function() menu_system.update(); } -void callback_treble_function() +void callback_treble_function(void) { #ifdef DEBUG Serial.println(F("callback_treble_function")); @@ -785,7 +785,7 @@ void callback_treble_function() menu_system.update(); } -void callback_stereo_function() +void callback_stereo_function(void) { #ifdef DEBUG Serial.println(F("callback_stereo_function")); @@ -797,7 +797,7 @@ void callback_stereo_function() menu_system.update(); } -void callback_transpose_function() +void callback_transpose_function(void) { #ifdef DEBUG Serial.println(F("callback_transpose_function")); @@ -809,7 +809,7 @@ void callback_transpose_function() menu_system.update(); } -void callback_tune_function() +void callback_tune_function(void) { #ifdef DEBUG Serial.println(F("callback_tune_function")); @@ -821,7 +821,7 @@ void callback_tune_function() menu_system.update(); } -void callback_detune_function() +void callback_detune_function(void) { #ifdef DEBUG Serial.println(F("callback_detune_function")); @@ -833,7 +833,7 @@ void callback_detune_function() menu_system.update(); } -void callback_velocity_sense_function() +void callback_velocity_sense_function(void) { #ifdef DEBUG Serial.println(F("callback_velocity_sense_function")); @@ -848,7 +848,7 @@ void callback_velocity_sense_function() /****************************************** EFFECTS CALLBACKS ******************************************/ -void callback_effect_function() +void callback_effect_function(void) { #ifdef DEBUG Serial.print(F("callback_effect_function, focus position: ")); @@ -872,7 +872,7 @@ void callback_effect_function() menu_system.update(); } -void callback_pan_trem_frequency_function() +void callback_pan_trem_frequency_function(void) { #ifdef DEBUG Serial.println(F("callback_pan_trem_frequency_function")); @@ -884,7 +884,7 @@ void callback_pan_trem_frequency_function() menu_system.update(); } -void callback_pan_trem_level_function() +void callback_pan_trem_level_function(void) { #ifdef DEBUG Serial.println(F("callback_pan_trem_level_function")); @@ -896,7 +896,7 @@ void callback_pan_trem_level_function() menu_system.update(); } -void callback_overdrive_function() +void callback_overdrive_function(void) { #ifdef DEBUG Serial.println(F("callback_overdrive_function")); @@ -908,7 +908,7 @@ void callback_overdrive_function() menu_system.update(); } -void callback_comp_gain_function() +void callback_comp_gain_function(void) { #ifdef DEBUG Serial.println(F("callback_comp_gain_function")); @@ -920,7 +920,7 @@ void callback_comp_gain_function() menu_system.update(); } -void callback_comp_response_function() +void callback_comp_response_function(void) { #ifdef DEBUG Serial.println(F("callback_comp_response_function")); @@ -932,7 +932,7 @@ void callback_comp_response_function() menu_system.update(); } -void callback_comp_limit_function() +void callback_comp_limit_function(void) { #ifdef DEBUG Serial.println(F("callback_comp_limit_function")); @@ -944,7 +944,7 @@ void callback_comp_limit_function() menu_system.update(); } -void callback_comp_threshold_function() +void callback_comp_threshold_function(void) { #ifdef DEBUG Serial.println(F("callback_comp_threshold_function")); @@ -956,7 +956,7 @@ void callback_comp_threshold_function() menu_system.update(); } -void callback_comp_attack_function() +void callback_comp_attack_function(void) { #ifdef DEBUG Serial.println(F("callback_comp_attack_function")); @@ -968,7 +968,7 @@ void callback_comp_attack_function() menu_system.update(); } -void callback_comp_decay_function() +void callback_comp_decay_function(void) { #ifdef DEBUG Serial.println(F("callback_comp_decay_function")); @@ -980,7 +980,7 @@ void callback_comp_decay_function() menu_system.update(); } -void callback_reverb_roomsize_function() +void callback_reverb_roomsize_function(void) { #ifdef DEBUG Serial.println(F("callback_reverb_roomsize_function")); @@ -992,7 +992,7 @@ void callback_reverb_roomsize_function() menu_system.update(); } -void callback_reverb_damping_function() +void callback_reverb_damping_function(void) { #ifdef DEBUG Serial.println(F("callback_reverb_damping_function")); @@ -1004,7 +1004,7 @@ void callback_reverb_damping_function() menu_system.update(); } -void callback_reverb_level_function() +void callback_reverb_level_function(void) { #ifdef DEBUG Serial.println(F("callback_reverb_level_function")); @@ -1016,7 +1016,7 @@ void callback_reverb_level_function() menu_system.update(); } -void callback_chorus_frequency_function() +void callback_chorus_frequency_function(void) { #ifdef DEBUG Serial.println(F("callback_chorus_frequency_function")); @@ -1034,7 +1034,7 @@ void callback_chorus_frequency_function() Serial.println("5"); } -void callback_chorus_delay_function() +void callback_chorus_delay_function(void) { #ifdef DEBUG Serial.println(F("callback_chorus_delay_function")); @@ -1046,7 +1046,7 @@ void callback_chorus_delay_function() menu_system.update(); } -void callback_chorus_level_function() +void callback_chorus_level_function(void) { #ifdef DEBUG Serial.println(F("callback_chorus_level_function")); @@ -1058,7 +1058,7 @@ void callback_chorus_level_function() menu_system.update(); } -void callback_bass_lr_level_function() +void callback_bass_lr_level_function(void) { #ifdef DEBUG Serial.println(F("callback_bass_lr_level_function")); @@ -1070,7 +1070,7 @@ void callback_bass_lr_level_function() menu_system.update(); } -void callback_bass_mono_level_function() +void callback_bass_mono_level_function(void) { #ifdef DEBUG Serial.println(F("callback_bass_mono_level_function")); @@ -1082,7 +1082,7 @@ void callback_bass_mono_level_function() menu_system.update(); } -void callback_eq_bass_function() +void callback_eq_bass_function(void) { #ifdef DEBUG Serial.println(F("callback_eq_bass_function")); @@ -1094,7 +1094,7 @@ void callback_eq_bass_function() menu_system.update(); } -void callback_eq_treble_function() +void callback_eq_treble_function(void) { #ifdef DEBUG Serial.println(F("callback_eq_treble_function")); @@ -1109,21 +1109,22 @@ void callback_eq_treble_function() /****************************************** SAVE SOUND CALLBACKS ******************************************/ -void callback_save_sound_function() { +void callback_save_sound_function(void) +{ #ifdef DEBUG Serial.println(F("callback_save_sound_function")); #endif menu_system.change_menu(save_sound_menu); menu_position[MAIN] = encoder_value[RIGHT_ENCODER]; encoder_value[RIGHT_ENCODER] = sound; - enc[RIGHT_ENCODER].write(sound, 1, 99); + enc[RIGHT_ENCODER].write(sound, 1, MAX_SOUNDS); menu_system.update(); } /****************************************** SYSTEM MENU CALLBACKS ******************************************/ -void callback_system_function() +void callback_system_function(void) { #ifdef DEBUG Serial.println(F("callback_system_function")); @@ -1146,7 +1147,7 @@ void callback_system_function() menu_system.update(); } -void callback_loudness_function() +void callback_loudness_function(void) { #ifdef DEBUG Serial.println(F("callback_loudness_function")); @@ -1158,7 +1159,7 @@ void callback_loudness_function() menu_system.update(); } -void callback_midi_channel_function() +void callback_midi_channel_function(void) { #ifdef DEBUG Serial.println(F("callback_midi_channel_function")); @@ -1170,7 +1171,7 @@ void callback_midi_channel_function() menu_system.update(); } -void callback_midi_soft_thru_function() +void callback_midi_soft_thru_function(void) { #ifdef DEBUG Serial.println(F("callback_midi_soft_thru_function")); @@ -1182,7 +1183,7 @@ void callback_midi_soft_thru_function() menu_system.update(); } -void callback_max_poly_function() +void callback_max_poly_function(void) { #ifdef DEBUG Serial.println(F("callback_max_poly_function")); @@ -1197,7 +1198,7 @@ void callback_max_poly_function() /****************************************** INFO MENU CALLBACKS ******************************************/ -void callback_info_function() +void callback_info_function(void) { #ifdef DEBUG Serial.println(F("callback_info_function")); @@ -2462,9 +2463,9 @@ void handle_ui(void) if (menu_system.get_currentScreen() == &edit_sound_screen) menu_callback_offset = NUM_MAIN_MENUS; else if (menu_system.get_currentScreen() == &effects_screen) - menu_callback_offset = NUM_MAIN_MENUS + NUM_LOAD_SOUNDS_MENUS + NUM_EDIT_SOUND_MENUS; + menu_callback_offset = NUM_MAIN_MENUS + NUM_EDIT_SOUND_MENUS; else if (menu_system.get_currentScreen() == &system_screen) - menu_callback_offset = NUM_MAIN_MENUS + NUM_LOAD_SOUNDS_MENUS + NUM_EDIT_SOUND_MENUS + NUM_EFFECTS_MENUS; // + NUM_SAVE_SOUNDS_MENUS; + menu_callback_offset = NUM_MAIN_MENUS + NUM_EDIT_SOUND_MENUS + NUM_EFFECTS_MENUS; #ifdef DEBUG Serial.print(F("Starting callback number ")); Serial.println(encoder_value[RIGHT_ENCODER] + 1 + menu_callback_offset, DEC); diff --git a/config.h b/config.h index 748bdd5..43bfaa5 100644 --- a/config.h +++ b/config.h @@ -97,7 +97,7 @@ 30: 1.22 Volts p-p 31: 1.16 Volts p-p */ -#define SGTL5000_LINEOUT_LEVEL 29 +#define SGTL5000_LINEOUT_LEVEL 30 //#define SDCARD_CS_PIN 10 //#define SDCARD_MOSI_PIN 7 //#define SDCARD_SCK_PIN 14