From 66ac206fb3e01d33a749538b0347dfd27ce29fef Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Tue, 12 May 2020 15:44:41 +0200 Subject: [PATCH] Several additions for better multi-instance-handling. --- UI.hpp | 385 ++++++++++++++++++++++++++++++++++--------------------- config.h | 4 +- 2 files changed, 241 insertions(+), 148 deletions(-) diff --git a/UI.hpp b/UI.hpp index a00dffe..f0d55cf 100644 --- a/UI.hpp +++ b/UI.hpp @@ -991,15 +991,17 @@ void UI_func_reverb_level(uint8_t param) void UI_func_chorus_frequency(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_float("Chorus Frq.", configuration.fx.chorus_frequency[instance_id], 0.1, CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX, 2, 1, false, false, false, true); } @@ -1033,15 +1035,17 @@ void UI_func_chorus_frequency(uint8_t param) void UI_func_chorus_waveform(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd.setCursor(0, 0); lcd.print(F("Chorus Waveform")); } @@ -1085,15 +1089,17 @@ void UI_func_chorus_waveform(uint8_t param) void UI_func_chorus_depth(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Chorus Dpt.", configuration.fx.chorus_depth[instance_id], 1.0, CHORUS_DEPTH_MIN, CHORUS_DEPTH_MAX, 3, false, false, false, true); } @@ -1129,15 +1135,17 @@ void UI_func_chorus_depth(uint8_t param) void UI_func_chorus_level(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Chorus Lvl.", configuration.fx.chorus_level[instance_id], 1.0, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 3, false, false, false, true); } @@ -1175,15 +1183,18 @@ void UI_func_chorus_level(uint8_t param) void UI_func_delay_time(uint8_t param) { - uint8_t instance_id = 0; + static uint8_t instance_id; - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Delay Time", configuration.fx.delay_time[instance_id], 10.0, DELAY_TIME_MIN, DELAY_TIME_MAX, 3, false, false, false, true); } @@ -1218,15 +1229,16 @@ void UI_func_delay_time(uint8_t param) void UI_func_delay_feedback(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Delay Feedb.", configuration.fx.delay_feedback[instance_id], 1.0, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 3, false, false, false, true); } @@ -1261,7 +1273,7 @@ void UI_func_delay_feedback(uint8_t param) void UI_func_delay_level(uint8_t param) { - uint8_t instance_id = 0; + static uint8_t instance_id; if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; @@ -1270,6 +1282,11 @@ void UI_func_delay_level(uint8_t param) { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Delay Lvl.", configuration.fx.delay_level[instance_id], 1.0, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 3, false, false, false, true); } @@ -1304,15 +1321,17 @@ void UI_func_delay_level(uint8_t param) void UI_func_reverb_send(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Reverb Send", configuration.fx.reverb_send[instance_id], 1.0, REVERB_SEND_MIN, REVERB_SEND_MAX, 3, false, false, false, true); } @@ -1348,15 +1367,17 @@ void UI_func_reverb_send(uint8_t param) void UI_func_filter_cutoff(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Filter Cut", configuration.dexed[instance_id].filter_cutoff, 1.0, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 3, false, false, false, true); } @@ -1391,15 +1412,17 @@ void UI_func_filter_cutoff(uint8_t param) void UI_func_filter_resonance(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Filter Res", configuration.dexed[instance_id].filter_resonance, 1.0, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 3, false, false, false, true); } @@ -1435,15 +1458,17 @@ void UI_func_filter_resonance(uint8_t param) void UI_func_transpose(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(METERBAR); lcd_display_meter_int("Transpose", configuration.dexed[instance_id].transpose, 1.0, -24.0, TRANSPOSE_MIN, TRANSPOSE_MAX, 3, false, false, true, true); } @@ -1479,15 +1504,17 @@ void UI_func_transpose(uint8_t param) void UI_func_tune(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(METERBAR); lcd_display_meter_int("Fine Tune", configuration.dexed[instance_id].tune, 1.0, -100.0, TUNE_MIN, TUNE_MAX, 3, false, false, true, true); } @@ -1523,15 +1550,17 @@ void UI_func_tune(uint8_t param) void UI_func_midi_channel(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd.setCursor(0, 0); lcd.print(F("MIDI Channel")); } @@ -1578,16 +1607,18 @@ void getNoteName(char* noteName, uint8_t noteNumber) void UI_func_lowest_note(uint8_t param) { - uint8_t instance_id = 0; + static uint8_t instance_id; char note_name[4]; - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; - if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + getNoteName(note_name, configuration.dexed[instance_id].lowest_note); lcd.setCursor(0, 0); lcd.print(F("Lowest Note")); @@ -1626,16 +1657,18 @@ void UI_func_lowest_note(uint8_t param) void UI_func_highest_note(uint8_t param) { - uint8_t instance_id = 0; + static uint8_t instance_id; char note_name[4]; - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; - if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + getNoteName(note_name, configuration.dexed[instance_id].highest_note); lcd.setCursor(0, 0); lcd.print(F("Highest Note")); @@ -1676,14 +1709,14 @@ void UI_func_sound_intensity(uint8_t param) { static uint8_t instance_id; - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; - else - instance_id = 0; - if (LCDML.FUNC_setup()) // ****** SETUP ********* { - encoderDir[ENC_R].reset(); + //encoderDir[ENC_R].reset(); + + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; lcd_special_chars(BLOCKBAR); @@ -1702,12 +1735,25 @@ void UI_func_sound_intensity(uint8_t param) if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) { + encoderDir[ENC_R].reset(); + if (LCDML.BT_checkDown()) configuration.dexed[instance_id].sound_intensity = constrain(configuration.dexed[instance_id].sound_intensity + ENCODER[ENC_R].speed(), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[instance_id].sound_intensity = constrain(configuration.dexed[instance_id].sound_intensity - ENCODER[ENC_R].speed(), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); +#if NUM_DEXED > 1 + if (LCDML.BT_checkEnter()) + { + instance_id = !instance_id; + lcd_active_instance_number(instance_id); + lcd.setCursor(15, 0); + lcd.write(5); + lcd.setCursor(15, 1); + lcd.write(6); + } +#endif } lcd_display_bar_int("Voice Level", configuration.dexed[instance_id].sound_intensity, 1.0, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, false, false, false, false); @@ -1729,15 +1775,19 @@ void UI_func_sound_intensity(uint8_t param) void UI_func_panorama(uint8_t param) { - uint8_t instance_id = 0; + static uint8_t instance_id; + - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + if (configuration.sys.mono > 0) { lcd.setCursor(0, 0); @@ -1969,15 +2019,17 @@ void UI_func_polyphony(uint8_t param) void UI_func_engine(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd.setCursor(0, 0); lcd.print(F("Engine")); } @@ -2023,15 +2075,17 @@ void UI_func_engine(uint8_t param) void UI_func_mono_poly(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd.setCursor(0, 0); lcd.print(F("Mono/Polyphonic")); } @@ -2074,7 +2128,7 @@ void UI_func_mono_poly(uint8_t param) void UI_func_note_refresh(uint8_t param) { - uint8_t instance_id = 0; + static uint8_t instance_id; if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) instance_id = 1; @@ -2083,6 +2137,9 @@ void UI_func_note_refresh(uint8_t param) { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + lcd.setCursor(0, 0); lcd.print(F("Note Refresh")); } @@ -2127,13 +2184,15 @@ void UI_func_pb_range(uint8_t param) { uint8_t instance_id = 0; - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; - if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("PB Range", configuration.dexed[instance_id].pb_range, 1.0, PB_RANGE_MIN, PB_RANGE_MAX, 2, false, false, false, true); } @@ -2168,15 +2227,17 @@ void UI_func_pb_range(uint8_t param) void UI_func_pb_step(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("PB Step", configuration.dexed[instance_id].pb_step, 1.0, PB_STEP_MIN, PB_STEP_MAX, 2, false, false, false, true); } @@ -2211,15 +2272,17 @@ void UI_func_pb_step(uint8_t param) void UI_func_mw_range(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("MW Range", configuration.dexed[instance_id].mw_range, 1.0, MW_RANGE_MIN, MW_RANGE_MAX, 2, false, false, false, true); } @@ -2254,15 +2317,17 @@ void UI_func_mw_range(uint8_t param) void UI_func_mw_assign(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd.setCursor(0, 0); lcd.print(F("MW Assign")); } @@ -2323,15 +2388,17 @@ void UI_func_mw_assign(uint8_t param) void UI_func_mw_mode(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd.setCursor(0, 0); lcd.print(F("MW Mode")); } @@ -2378,15 +2445,17 @@ void UI_func_mw_mode(uint8_t param) void UI_func_fc_range(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("FC Range", configuration.dexed[instance_id].fc_range, 1.0, FC_RANGE_MIN, FC_RANGE_MAX, 2, false, false, false, true); } @@ -2421,15 +2490,17 @@ void UI_func_fc_range(uint8_t param) void UI_func_fc_assign(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd.setCursor(0, 0); lcd.print(F("FC Assign")); } @@ -2490,15 +2561,17 @@ void UI_func_fc_assign(uint8_t param) void UI_func_fc_mode(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd.setCursor(0, 0); lcd.print(F("FC Mode")); } @@ -2545,15 +2618,17 @@ void UI_func_fc_mode(uint8_t param) void UI_func_bc_range(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("BC Range", configuration.dexed[instance_id].bc_range, 1.0, BC_RANGE_MIN, BC_RANGE_MAX, 2, false, false, false, true); } @@ -2588,15 +2663,17 @@ void UI_func_bc_range(uint8_t param) void UI_func_bc_assign(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd.setCursor(0, 0); lcd.print(F("BC Assign")); } @@ -2657,15 +2734,17 @@ void UI_func_bc_assign(uint8_t param) void UI_func_bc_mode(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd.setCursor(0, 0); lcd.print(F("BC Mode")); } @@ -2712,15 +2791,17 @@ void UI_func_bc_mode(uint8_t param) void UI_func_at_range(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("AT Range", configuration.dexed[instance_id].at_range, 1.0, AT_RANGE_MIN, AT_RANGE_MAX, 2, false, false, false, true); } @@ -2755,15 +2836,17 @@ void UI_func_at_range(uint8_t param) void UI_func_at_assign(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd.setCursor(0, 0); lcd.print(F("AT Assign")); } @@ -2824,15 +2907,17 @@ void UI_func_at_assign(uint8_t param) void UI_func_at_mode(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd.setCursor(0, 0); lcd.print(F("AT Mode")); } @@ -2879,15 +2964,17 @@ void UI_func_at_mode(uint8_t param) void UI_func_portamento_mode(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd.setCursor(0, 0); lcd.print(F("Portamento Mode")); } @@ -2936,15 +3023,17 @@ void UI_func_portamento_mode(uint8_t param) void UI_func_portamento_glissando(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd.setCursor(0, 0); lcd.print(F("Portam. Gliss.")); } @@ -2987,15 +3076,17 @@ void UI_func_portamento_glissando(uint8_t param) void UI_func_portamento_time(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Portam. Time", configuration.dexed[instance_id].portamento_time, 1.0, PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX, 2, false, false, false, true); } @@ -3222,15 +3313,17 @@ void UI_func_midi_soft_thru(uint8_t param) void UI_func_velocity_level(uint8_t param) { - uint8_t instance_id = 0; - - if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) - instance_id = 1; + static uint8_t instance_id; if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + else + instance_id = 0; + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Velocity Lvl", configuration.dexed[instance_id].velocity_level, 1.0, VELOCITY_LEVEL_MIN, VELOCITY_LEVEL_MAX, 3, false, false, false, true); } diff --git a/config.h b/config.h index a5d5064..36a0a7a 100644 --- a/config.h +++ b/config.h @@ -240,8 +240,8 @@ //************************************************************************************************* //* DO NO CHANGE ANYTHING BEYOND IF YOU DON'T KNOW WHAT YOU ARE DOING !!! //************************************************************************************************* -#define NUM_DEXED 2 -#define MAX_DEXED 2 // No - even don't think about increasing this number! IT GENERATE MASSIVE PROBLEMS! +#define NUM_DEXED 2 // 1 or 2 - nothing else! +#define MAX_DEXED 2 // No! - even don't think about increasing this number! IT WILL PRODUCE MASSIVE PROBLEMS! //#define CPU_OVERLOAD_THROTTLE 95.0 // Level (in percent) when throttling should start #define CPU_OVERLOAD_THROTTLE_TIMER 100 // timer (in ms) when next throttling is possible #define CONTROL_RATE_MS 100