From 0e03e41f2aaaef67509fd9e3be87fc6886c61600 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Mon, 30 Dec 2019 17:36:59 +0100 Subject: [PATCH] Added menu entries for loading/saving setups. --- MicroDexed.ino | 1 + UI.hpp | 100 ++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 88 insertions(+), 13 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 0e4076e..5d63c6b 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -197,6 +197,7 @@ char bank_name[NUM_DEXED][BANK_NAME_LEN]; char voice_name[NUM_DEXED][VOICE_NAME_LEN]; char bank_names[NUM_DEXED][MAX_BANKS][BANK_NAME_LEN]; char voice_names[NUM_DEXED][MAX_VOICES][VOICE_NAME_LEN]; +uint8_t dexed_setup_number = 1; elapsedMillis autostore; uint8_t midi_timing_counter = 0; // 24 per qarter elapsedMillis midi_timing_timestep; diff --git a/UI.hpp b/UI.hpp index 7c1104a..9e04d5b 100644 --- a/UI.hpp +++ b/UI.hpp @@ -48,6 +48,7 @@ #define _LCDML_DISP_cfg_scrollbar 1 // enable a scrollbar extern config_t configuration; +extern uint8_t dexed_setup_number; extern void set_volume(uint8_t v, uint8_t m); extern char bank_names[NUM_DEXED][MAX_BANKS][BANK_NAME_LEN]; extern char bank_name[NUM_DEXED][BANK_NAME_LEN]; @@ -184,6 +185,8 @@ void UI_handle_OP(uint8_t param, uint8_t op, uint8_t instance_id); void UI_func_information(uint8_t param); void UI_func_voice_selection(uint8_t param); void UI_func_volume(uint8_t param); +void UI_func_load(uint8_t param); +void UI_func_save(uint8_t param); void UI_function_not_enabled(void); void UI_function_not_implemented(uint8_t param); void lcd_display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool sign); @@ -292,11 +295,13 @@ LCDML_add(93, LCDML_0_2, 3, "Delay", NULL); LCDML_add(94, LCDML_0_2_3, 1, "Time", UI_func_delay_time); LCDML_add(95, LCDML_0_2_3, 2, "Feedback", UI_func_delay_feedback); LCDML_add(96, LCDML_0_2_3, 3, "Level", UI_func_delay_level); -LCDML_add(97, LCDML_0, 3, "Store", NULL); -LCDML_add(98, LCDML_0, 4, "System", NULL); -LCDML_add(99, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono); -LCDML_add(100, LCDML_0, 5, "Info", UI_func_information); -#define _LCDML_DISP_cnt 100 +LCDML_add(97, LCDML_0, 3, "Load/Save", NULL); +LCDML_add(98, LCDML_0_3, 1, "Load", UI_func_load); +LCDML_add(99, LCDML_0_3, 2, "Save", UI_func_save); +LCDML_add(100, LCDML_0, 4, "System", NULL); +LCDML_add(101, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(102, LCDML_0, 5, "Info", UI_func_information); +#define _LCDML_DISP_cnt 102 #define MENU_ID_OF_INSTANCE_2 42 #else LCDML_add(0, LCDML_0, 1, "Setup", NULL); @@ -354,11 +359,13 @@ LCDML_add(51, LCDML_0_2, 3, "Delay", NULL); LCDML_add(52, LCDML_0_2_3, 1, "Time", UI_func_delay_time); LCDML_add(53, LCDML_0_2_3, 2, "Feedback", UI_func_delay_feedback); LCDML_add(54, LCDML_0_2_3, 3, "Level", UI_func_delay_level); -LCDML_add(55, LCDML_0, 3, "Store", NULL); -LCDML_add(56, LCDML_0, 4, "System", NULL); -LCDML_add(57, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono); -LCDML_add(58, LCDML_0, 5, "Info", UI_func_information); -#define _LCDML_DISP_cnt 58 +LCDML_add(55, LCDML_0, 3, "Load/Save", NULL); +LCDML_add(56, LCDML_0_3, 1, "Load", UI_func_load); +LCDML_add(57, LCDML_0_3, 2, "Save", UI_func_save); +LCDML_add(58, LCDML_0, 4, "System", NULL); +LCDML_add(59, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(60, LCDML_0, 5, "Info", UI_func_information); +#define _LCDML_DISP_cnt 60 #define MENU_ID_OF_INSTANCE_2 41 #endif // create menu @@ -3282,15 +3289,59 @@ void UI_func_volume(uint8_t param) eeprom_write(); } -void UI_function_not_enabled(void) +void UI_func_load(uint8_t param) { if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function lcd.setCursor(0, 0); - lcd.print(F("Function not")); + lcd.print(F("Load setup")); + } + + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if (LCDML.BT_checkEnter()) + { + LCDML.FUNC_goBackToMenu(); + } + else if (LCDML.BT_checkDown() || LCDML.BT_checkUp()) + { + if (LCDML.BT_checkDown()) + { + if (dexed_setup_number < 100) + { + dexed_setup_number++; + } + } + else if (LCDML.BT_checkUp()) + { + if (dexed_setup_number > 1) + { + dexed_setup_number--; + } + } + + //LOAD SYSEX FILE + } + lcd.setCursor(0, 1); - lcd.print(F("enabled!")); + lcd_display_int(dexed_setup_number, 2, false, true, false); + } + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + // you can here reset some global vars or do nothing + eeprom_write(); + } +} + +void UI_func_save(uint8_t param) +{ + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + // setup function + lcd.setCursor(0, 0); + lcd.print(F("Save setup")); } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -3299,11 +3350,34 @@ void UI_function_not_enabled(void) { LCDML.FUNC_goBackToMenu(); } + else if (LCDML.BT_checkDown() || LCDML.BT_checkUp()) + { + if (LCDML.BT_checkDown()) + { + if (dexed_setup_number < 100) + { + dexed_setup_number++; + } + } + else if (LCDML.BT_checkUp()) + { + if (dexed_setup_number > 1) + { + dexed_setup_number--; + } + } + + //SAVE SYSEX FILE + } + + lcd.setCursor(0, 1); + lcd_display_int(dexed_setup_number, 2, false, true, false); } if (LCDML.FUNC_close()) // ****** STABLE END ********* { // you can here reset some global vars or do nothing + eeprom_write(); } }