From ef3b8d47006ea0a5baac3c0f7f2fa95faf929545 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Mon, 6 Apr 2020 16:04:53 +0200 Subject: [PATCH] Using new beta LCDMenuLib2 from Nils. Great! --- MicroDexed.ino | 19 +---- UI.hpp | 201 +++++++++++-------------------------------------- 2 files changed, 46 insertions(+), 174 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index b524c41..bd59ce8 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -903,24 +903,6 @@ void handleProgramChange(byte inChannel, byte inProgram) void handleSystemExclusive(byte * sysex, uint len) { - /* - SYSEX MESSAGE: Parameter Change - ------------------------------- - bits hex description - - 11110000 F0 Status byte - start sysex - 0iiiiiii 43 ID # (i=67; Yamaha) - 0sssnnnn 10 Sub-status (s=1) & channel number (n=0; ch 1) - 0gggggpp ** parameter group # (g=0; voice, g=2; function) - 0ppppppp ** parameter # (these are listed in next section) - Note that voice parameter #'s can go over 128 so - the pp bits in the group byte are either 00 for - par# 0-127 or 01 for par# 128-155. In the latter case - you add 128 to the 0ppppppp byte to compute par#. - 0ddddddd ** data byte - 11110111 F7 Status - end sysex - */ - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { if (!checkMidiChannel((sysex[2] & 0x0f) + 1 , instance_id)) @@ -932,6 +914,7 @@ void handleSystemExclusive(byte * sysex, uint len) #endif return; } + #ifdef DEBUG Serial.print(F("INSTANCE ")); Serial.print(instance_id, DEC); diff --git a/UI.hpp b/UI.hpp index d0d172b..7db990a 100644 --- a/UI.hpp +++ b/UI.hpp @@ -141,9 +141,6 @@ enum { SCROLLBAR, BLOCKBAR, METERBAR }; enum { ENC_R, ENC_L }; enum {MENU_VOICE_BANK, MENU_VOICE_SOUND}; uint8_t menu_voice_select = MENU_VOICE_SOUND; -uint8_t last_menu = 0; -uint8_t last_cursor = 0; -bool inside_menu = false; void lcdml_menu_display(void); void lcdml_voice_menu_display(void); @@ -415,7 +412,7 @@ void setup_ui(void) // Enable Menu Rollover //LCDML.MENU_enRollover(); // Enable Screensaver (screensaver menu function, time to activate in ms) - LCDML.SCREEN_enable(UI_func_voice_select, VOICE_SELECTION_MS); // set to 10 seconds + LCDML.SCREEN_enable(UI_func_voice_select, VOICE_SELECTION_MS); } #ifdef DEBUG @@ -465,27 +462,24 @@ void lcdml_menu_control(void) encoderDir[ENC_R].reset(); eeprom_write(); - if (last_menu < 0xff && inside_menu == true) - LCDML.OTHER_jumpToID(last_menu); - else + if (LCDML.MENU_getLastActivFunctionID() == 0xff && LCDML.MENU_getLastCursorPositionID() == 0) + LCDML.MENU_goRoot(); + else if (LCDML.MENU_getLastCursorPositionID() < 0xff && LCDML.MENU_getLastActivFunctionID() == 0xff) + { + LCDML.OTHER_setCursorToID(LCDML.MENU_getLastCursorPositionID()); + LCDML.BT_quit(); + } + else if (LCDML.MENU_getLastActivFunctionID() < 0xff) { - LCDML.OTHER_setCursorToID(last_cursor); - LCDML.DISP_update(); + if (LCDML.MENU_getLastActivFunctionID() != VOLUME_MENU_ID) + LCDML.OTHER_jumpToID(LCDML.MENU_getLastActivFunctionID()); + else + LCDML.BT_quit(); } + else + LCDML.BT_quit(); } - /* - Serial.print("current_cursor="); - Serial.print(get_current_cursor_id()); - Serial.print(" last_cursor="); - Serial.print(last_cursor); - Serial.print(" last_menu="); - Serial.print(last_menu); - Serial.print(" inside_menu="); - Serial.print(inside_menu); - Serial.println(); - */ - // Volatile Variables long g_LCDML_CONTROL_Encoder_position[NUM_ENCODER] = {ENCODER[ENC_R].read(), ENCODER[ENC_L].read()}; bool button[NUM_ENCODER] = {digitalRead(BUT_R_PIN), digitalRead(BUT_L_PIN)}; @@ -513,7 +507,6 @@ void lcdml_menu_control(void) Serial.println(F("ENC-R down")); #endif encoderDir[ENC_R].Down(true); - last_cursor = get_current_cursor_id(); LCDML.BT_down(); } ENCODER[ENC_R].write(g_LCDML_CONTROL_Encoder_position[ENC_R] + 4); @@ -536,7 +529,6 @@ void lcdml_menu_control(void) Serial.println(F("ENC-R up")); #endif encoderDir[ENC_R].Up(true); - last_cursor = get_current_cursor_id(); LCDML.BT_up(); } ENCODER[ENC_R].write(g_LCDML_CONTROL_Encoder_position[ENC_R] - 4); @@ -570,7 +562,6 @@ void lcdml_menu_control(void) if (LCDML.FUNC_getID() != PATCH_MENU_ID1) #endif { - last_cursor = get_current_cursor_id(); LCDML.OTHER_jumpToFunc(UI_func_voice_select); } } @@ -607,7 +598,6 @@ void lcdml_menu_control(void) LCDML.BT_down(); if (LCDML.FUNC_getID() != VOLUME_MENU_ID) { - last_cursor = get_current_cursor_id(); LCDML.OTHER_jumpToFunc(UI_func_volume); } } @@ -634,7 +624,6 @@ void lcdml_menu_control(void) LCDML.BT_up(); if (LCDML.FUNC_getID() != VOLUME_MENU_ID) { - last_cursor = get_current_cursor_id(); LCDML.OTHER_jumpToFunc(UI_func_volume); } } @@ -671,30 +660,30 @@ void lcdml_menu_control(void) Serial.println(F("ENC-L short")); #endif encoderDir[ENC_L].ButtonShort(true); - inside_menu = false; - switch (LCDML.FUNC_getID()) + + if (LCDML.MENU_getLastActivFunctionID() == 0xff && LCDML.MENU_getLastCursorPositionID() == 0) + LCDML.MENU_goRoot(); + else if (LCDML.MENU_getLastCursorPositionID() < 0xff && LCDML.MENU_getLastActivFunctionID() == 0xff) { - case VOLUME_MENU_ID: - if (last_menu < 0xff && inside_menu == true) - LCDML.OTHER_jumpToID(last_menu); - else - { - LCDML.OTHER_setCursorToID(last_cursor); - LCDML.DISP_update(); - } - break; - case PATCH_MENU_ID1: -#if defined(PATCH_MENU_ID2) - case PATCH_MENU_ID2: + LCDML.OTHER_setCursorToID(LCDML.MENU_getLastCursorPositionID()); + LCDML.BT_quit(); + } + else if (LCDML.MENU_getLastActivFunctionID() < 0xff) + { +#ifdef PATCH_MENU_ID2 + if (LCDML.MENU_getLastActivFunctionID() == VOLUME_MENU_ID || LCDML.MENU_getLastActivFunctionID() == PATCH_MENU_ID1 || LCDML.MENU_getLastActivFunctionID() == PATCH_MENU_ID2) +#else + if (LCDML.MENU_getLastActivFunctionID() == VOLUME_MENU_ID || LCDML.MENU_getLastActivFunctionID() == PATCH_MENU_ID1) #endif - if (last_cursor == 0) - LCDML.MENU_goRoot(); - else - LCDML.OTHER_setCursorToID(last_cursor); - break; - default: + { + LCDML.OTHER_setCursorToID(LCDML.MENU_getLastCursorPositionID()); LCDML.BT_quit(); + } + else + LCDML.OTHER_jumpToID(LCDML.MENU_getLastActivFunctionID()); } + else + LCDML.BT_quit(); } } } @@ -850,8 +839,6 @@ void UI_func_reverb_roomsize(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Reverb Room", configuration.reverb_roomsize, 1.0, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX, 3, false, false, false, true); @@ -890,8 +877,6 @@ void UI_func_reverb_damping(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Reverb Damp.", configuration.reverb_damping, 1.0, REVERB_DAMPING_MIN, REVERB_DAMPING_MAX, 3, false, false, false, true); @@ -935,8 +920,6 @@ void UI_func_reverb_send(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Reverb Send", configuration.dexed[instance_id].reverb_send, 1.0, REVERB_SEND_MIN, REVERB_SEND_MAX, 3, false, false, false, true); @@ -975,8 +958,6 @@ void UI_func_reverb_level(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Reverb Level", configuration.reverb_level, 1.0, REVERB_LEVEL_MIN, REVERB_LEVEL_MAX, 3, false, false, false, true); @@ -1015,8 +996,6 @@ void UI_func_chorus_frequency(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd_special_chars(BLOCKBAR); lcd_display_bar_float("Chorus Frq.", configuration.chorus_frequency, 0.1, CHORUS_FREQUENCY_MIN, CHORUS_FREQUENCY_MAX, 2, 1, false, false, false, true); @@ -1054,8 +1033,6 @@ void UI_func_chorus_waveform(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("Chorus Waveform")); @@ -1103,8 +1080,6 @@ void UI_func_chorus_depth(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Chorus Dpt.", configuration.chorus_depth, 1.0, CHORUS_DEPTH_MIN, CHORUS_DEPTH_MAX, 3, false, false, false, true); @@ -1147,8 +1122,6 @@ void UI_func_chorus_send(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Chorus Send", configuration.dexed[instance_id].chorus_send, 1.0, CHORUS_SEND_MIN, CHORUS_SEND_MAX, 3, false, false, false, true); @@ -1187,8 +1160,6 @@ void UI_func_chorus_level(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Chorus Lvl.", configuration.chorus_level, 1.0, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 3, false, false, false, true); @@ -1227,8 +1198,6 @@ void UI_func_delay_time(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Delay Time", configuration.delay_time, 10.0, DELAY_TIME_MIN, DELAY_TIME_MAX, 3, false, false, false, true); @@ -1267,8 +1236,6 @@ void UI_func_delay_feedback(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Delay Feedb.", configuration.delay_feedback, 1.0, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 3, false, false, false, true); @@ -1313,8 +1280,6 @@ void UI_func_delay_send(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Delay Send", configuration.dexed[instance_id].delay_send, 1.0, DELAY_SEND_MIN, DELAY_SEND_MAX, 3, false, false, false, true); @@ -1353,8 +1318,6 @@ void UI_func_delay_level(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Delay Lvl.", configuration.delay_level, 1.0, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 3, false, false, false, true); @@ -1398,8 +1361,6 @@ void UI_func_filter_cutoff(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; 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); @@ -1442,8 +1403,6 @@ void UI_func_filter_resonance(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; 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); @@ -1487,8 +1446,6 @@ void UI_func_transpose(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; 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); @@ -1532,8 +1489,6 @@ void UI_func_tune(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; 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); @@ -1577,8 +1532,6 @@ void UI_func_midi_channel(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("MIDI Channel")); @@ -1634,8 +1587,6 @@ void UI_func_lowest_note(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; getNoteName(note_name, configuration.dexed[instance_id].lowest_note); lcd.setCursor(0, 0); @@ -1683,8 +1634,6 @@ void UI_func_highest_note(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; getNoteName(note_name, configuration.dexed[instance_id].highest_note); lcd.setCursor(0, 0); @@ -1731,8 +1680,6 @@ void UI_func_sound_intensity(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd_special_chars(BLOCKBAR); lcd_display_bar_float("Voice Level", float(configuration.dexed[instance_id].sound_intensity), 1.0, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, 0, false, false, false, true); @@ -1776,8 +1723,6 @@ void UI_func_panorama(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; if (configuration.mono > 0) { @@ -1789,8 +1734,6 @@ void UI_func_panorama(uint8_t param) } lcd_special_chars(METERBAR); lcd_display_meter_float("Panorama", configuration.dexed[instance_id].pan, 0.05, -20.0, PANORAMA_MIN, PANORAMA_MAX, 3, 1, false, false, true, true); - - Serial.print("VVVV---->"); Serial.println(last_menu); } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -1824,8 +1767,6 @@ void UI_func_stereo_mono(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("Stereo/Mono")); @@ -1902,8 +1843,6 @@ void UI_func_polyphony(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Polyphony", configuration.dexed[instance_id].polyphony, 1.0, POLYPHONY_MIN, POLYPHONY_MAX, 3, false, false, false, true); @@ -1946,8 +1885,6 @@ void UI_func_engine(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("Engine")); @@ -2001,8 +1938,6 @@ void UI_func_mono_poly(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("Mono/Polyphonic")); @@ -2053,8 +1988,6 @@ void UI_func_note_refresh(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("Note Refresh")); @@ -2105,8 +2038,6 @@ void UI_func_pb_range(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; 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); @@ -2149,8 +2080,6 @@ void UI_func_pb_step(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; 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); @@ -2193,8 +2122,6 @@ void UI_func_mw_range(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; 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); @@ -2237,8 +2164,6 @@ void UI_func_mw_assign(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("MW Assign")); @@ -2307,8 +2232,6 @@ void UI_func_mw_mode(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("MW Mode")); @@ -2363,8 +2286,6 @@ void UI_func_fc_range(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; 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); @@ -2408,8 +2329,6 @@ void UI_func_fc_assign(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("FC Assign")); @@ -2478,8 +2397,6 @@ void UI_func_fc_mode(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("FC Mode")); @@ -2534,8 +2451,6 @@ void UI_func_bc_range(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; 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); @@ -2578,8 +2493,6 @@ void UI_func_bc_assign(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("BC Assign")); @@ -2648,8 +2561,6 @@ void UI_func_bc_mode(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("BC Mode")); @@ -2704,8 +2615,6 @@ void UI_func_at_range(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; 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); @@ -2748,8 +2657,6 @@ void UI_func_at_assign(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("AT Assign")); @@ -2818,8 +2725,6 @@ void UI_func_at_mode(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("AT Mode")); @@ -2874,8 +2779,6 @@ void UI_func_portamento_mode(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("Portamento Mode")); @@ -2932,8 +2835,6 @@ void UI_func_portamento_glissando(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("Portam. Gliss.")); @@ -2984,8 +2885,6 @@ void UI_func_portamento_time(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; 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); @@ -3085,8 +2984,6 @@ void UI_handle_OP(uint8_t param, uint8_t op, uint8_t instance_id) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("Operator ")); @@ -3149,8 +3046,6 @@ void UI_func_information(uint8_t param) char version_string[LCD_cols + 1]; encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; generate_version_string(version_string, sizeof(version_string)); @@ -3181,8 +3076,6 @@ void UI_func_midi_soft_thru(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("MIDI Soft THRU")); @@ -3230,8 +3123,6 @@ void UI_func_velocity_level(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; 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); @@ -3270,8 +3161,6 @@ void UI_func_firmware_reset(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; // setup function lcd.print("Firmware reset?"); @@ -3333,8 +3222,11 @@ void UI_func_voice_select(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { encoderDir[ENC_R].reset(); - last_menu = LCDML.FUNC_getID(); - inside_menu = true; + + if (LCDML.FUNC_getID() < 0xff) + LCDML.FUNC_setGoBackToLastFunc(); + else + LCDML.FUNC_setGoBackToLastCursorPosition(); strip_extension(bank_names[instance_id][configuration.dexed[instance_id].bank], bank_name[instance_id]); @@ -3503,6 +3395,11 @@ void UI_func_volume(uint8_t param) { encoderDir[ENC_L].reset(); + if (LCDML.FUNC_getID() < 0xff) + LCDML.FUNC_setGoBackToLastFunc(); + else + LCDML.FUNC_setGoBackToLastCursorPosition(); + lcd_special_chars(BLOCKBAR); lcd_display_bar_int("Master Vol.", configuration.vol, 1.0, VOLUME_MIN, VOLUME_MAX, 3, false, false, false, true); @@ -3535,14 +3432,6 @@ void UI_func_volume(uint8_t param) eeprom_write(); encoderDir[ENC_L].reset(); - - if (last_menu < 0xff && inside_menu == true) - LCDML.OTHER_jumpToID(last_menu); - else - { - LCDML.OTHER_setCursorToID(last_cursor); - LCDML.DISP_update(); - } } }