diff --git a/UI.hpp b/UI.hpp index 32e72f5..f2e4478 100644 --- a/UI.hpp +++ b/UI.hpp @@ -141,7 +141,9 @@ 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 = 0xff; +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); @@ -435,6 +437,16 @@ void setup_debug_message(void) /*********************************************************************** MENU CONTROL ***********************************************************************/ +uint8_t get_current_cursor_id(void) +{ + LCDMenuLib2_menu *tmp; + + if ((tmp = LCDML.MENU_getCurrentObj()) != NULL) + return (tmp->getChild(LCDML.MENU_getCursorPosAbs())->getID()); + else + return (0); +} + void lcdml_menu_control(void) { // If something must init, put in in the setup condition @@ -447,6 +459,33 @@ void lcdml_menu_control(void) ENCODER[ENC_L].begin(); } + if (back_from_volume > BACK_FROM_VOLUME_MS && LCDML.FUNC_getID() == VOLUME_MENU_ID) + { + encoderDir[ENC_L].reset(); + encoderDir[ENC_R].reset(); + eeprom_write(); + + if (last_menu < 0xff && inside_menu == true) + LCDML.OTHER_jumpToID(last_menu); + else + { + LCDML.OTHER_setCursorToID(last_cursor); + LCDML.DISP_update(); + } + } + + /* + 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)}; @@ -474,6 +513,7 @@ 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); @@ -496,6 +536,7 @@ 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); @@ -555,6 +596,11 @@ void lcdml_menu_control(void) #endif encoderDir[ENC_L].Down(true); LCDML.BT_down(); + if (LCDML.FUNC_getID() != VOLUME_MENU_ID) + { + last_cursor = get_current_cursor_id(); + LCDML.OTHER_jumpToFunc(UI_func_volume); + } } ENCODER[ENC_L].write(g_LCDML_CONTROL_Encoder_position[ENC_L] + 4); } @@ -577,6 +623,11 @@ void lcdml_menu_control(void) #endif encoderDir[ENC_L].Up(true); LCDML.BT_up(); + if (LCDML.FUNC_getID() != VOLUME_MENU_ID) + { + last_cursor = get_current_cursor_id(); + LCDML.OTHER_jumpToFunc(UI_func_volume); + } } ENCODER[ENC_L].write(g_LCDML_CONTROL_Encoder_position[ENC_L] - 4); } @@ -611,7 +662,19 @@ void lcdml_menu_control(void) Serial.println(F("ENC-L short")); #endif encoderDir[ENC_L].ButtonShort(true); - LCDML.BT_quit(); + inside_menu = false; + if (LCDML.FUNC_getID() == VOLUME_MENU_ID) + { + if (last_menu < 0xff && inside_menu == true) + LCDML.OTHER_jumpToID(last_menu); + else + { + LCDML.OTHER_setCursorToID(last_cursor); + LCDML.DISP_update(); + } + } + else + LCDML.BT_quit(); } } } @@ -768,6 +831,7 @@ void UI_func_reverb_roomsize(uint8_t param) { 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); @@ -798,7 +862,6 @@ void UI_func_reverb_roomsize(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -808,6 +871,7 @@ void UI_func_reverb_damping(uint8_t param) { 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); @@ -838,7 +902,6 @@ void UI_func_reverb_damping(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -853,6 +916,7 @@ void UI_func_reverb_send(uint8_t param) { 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); @@ -883,7 +947,6 @@ void UI_func_reverb_send(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -893,6 +956,7 @@ void UI_func_reverb_level(uint8_t param) { 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); @@ -923,7 +987,6 @@ void UI_func_reverb_level(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -933,6 +996,7 @@ void UI_func_chorus_frequency(uint8_t param) { 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); @@ -962,7 +1026,6 @@ void UI_func_chorus_frequency(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -972,6 +1035,7 @@ void UI_func_chorus_waveform(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("Chorus Waveform")); @@ -1011,7 +1075,6 @@ void UI_func_chorus_waveform(uint8_t param) // you can here reset some global vars or do nothing eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1021,6 +1084,7 @@ void UI_func_chorus_depth(uint8_t param) { 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); @@ -1050,7 +1114,6 @@ void UI_func_chorus_depth(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1065,6 +1128,7 @@ void UI_func_chorus_send(uint8_t param) { 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); @@ -1095,7 +1159,6 @@ void UI_func_chorus_send(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1105,6 +1168,7 @@ void UI_func_chorus_level(uint8_t param) { 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); @@ -1135,7 +1199,6 @@ void UI_func_chorus_level(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1145,6 +1208,7 @@ void UI_func_delay_time(uint8_t param) { 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); @@ -1175,7 +1239,6 @@ void UI_func_delay_time(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1185,6 +1248,7 @@ void UI_func_delay_feedback(uint8_t param) { 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); @@ -1216,7 +1280,6 @@ void UI_func_delay_feedback(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1231,6 +1294,7 @@ void UI_func_delay_send(uint8_t param) { 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); @@ -1261,7 +1325,6 @@ void UI_func_delay_send(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1271,6 +1334,7 @@ void UI_func_delay_level(uint8_t param) { 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); @@ -1301,7 +1365,6 @@ void UI_func_delay_level(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1316,6 +1379,7 @@ void UI_func_filter_cutoff(uint8_t param) { 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); @@ -1345,7 +1409,6 @@ void UI_func_filter_cutoff(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1360,6 +1423,7 @@ void UI_func_filter_resonance(uint8_t param) { 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); @@ -1389,7 +1453,6 @@ void UI_func_filter_resonance(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } #endif @@ -1405,6 +1468,7 @@ void UI_func_transpose(uint8_t param) { 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); @@ -1435,7 +1499,6 @@ void UI_func_transpose(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1450,6 +1513,7 @@ void UI_func_tune(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd_special_chars(METERBAR); lcd_display_meter_int("Tune", configuration.dexed[instance_id].tune, 1.0, -100.0, TUNE_MIN, TUNE_MAX, 3, false, false, true, true); @@ -1480,7 +1544,6 @@ void UI_func_tune(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1495,6 +1558,7 @@ void UI_func_midi_channel(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("MIDI Channel")); @@ -1527,7 +1591,6 @@ void UI_func_midi_channel(uint8_t param) // you can here reset some global vars or do nothing eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1552,6 +1615,7 @@ void UI_func_lowest_note(uint8_t param) { 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); @@ -1585,7 +1649,6 @@ void UI_func_lowest_note(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1601,6 +1664,7 @@ void UI_func_highest_note(uint8_t param) { 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); @@ -1634,7 +1698,6 @@ void UI_func_highest_note(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1649,6 +1712,7 @@ void UI_func_sound_intensity(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd_special_chars(BLOCKBAR); lcd_display_bar_float("Volume", float(configuration.dexed[instance_id].sound_intensity), 1.0, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, 0, false, false, false, true); @@ -1679,7 +1743,6 @@ void UI_func_sound_intensity(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1694,6 +1757,7 @@ void UI_func_panorama(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; if (configuration.mono > 0) { @@ -1705,6 +1769,8 @@ 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 ********* @@ -1730,7 +1796,6 @@ void UI_func_panorama(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1740,6 +1805,7 @@ void UI_func_stereo_mono(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("Stereo/Mono")); @@ -1803,7 +1869,6 @@ void UI_func_stereo_mono(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1818,6 +1883,7 @@ void UI_func_polyphony(uint8_t param) { 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); @@ -1847,7 +1913,6 @@ void UI_func_polyphony(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1862,6 +1927,7 @@ void UI_func_engine(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("Engine")); @@ -1902,7 +1968,6 @@ void UI_func_engine(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1917,6 +1982,7 @@ void UI_func_mono_poly(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("Mono/Polyphonic")); @@ -1954,7 +2020,6 @@ void UI_func_mono_poly(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -1969,6 +2034,7 @@ void UI_func_note_refresh(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("Note Refresh")); @@ -2006,7 +2072,6 @@ void UI_func_note_refresh(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2021,6 +2086,7 @@ void UI_func_pb_range(uint8_t param) { 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); @@ -2050,7 +2116,6 @@ void UI_func_pb_range(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2065,7 +2130,7 @@ void UI_func_pb_step(uint8_t param) { 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); @@ -2095,7 +2160,6 @@ void UI_func_pb_step(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2110,6 +2174,7 @@ void UI_func_mw_range(uint8_t param) { 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); @@ -2139,7 +2204,6 @@ void UI_func_mw_range(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2154,6 +2218,7 @@ void UI_func_mw_assign(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("MW Assign")); @@ -2209,7 +2274,6 @@ void UI_func_mw_assign(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2224,6 +2288,7 @@ void UI_func_mw_mode(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("MW Mode")); @@ -2265,7 +2330,6 @@ void UI_func_mw_mode(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2280,6 +2344,7 @@ void UI_func_fc_range(uint8_t param) { 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); @@ -2310,7 +2375,6 @@ void UI_func_fc_range(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2325,6 +2389,7 @@ void UI_func_fc_assign(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("FC Assign")); @@ -2380,7 +2445,6 @@ void UI_func_fc_assign(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2395,6 +2459,7 @@ void UI_func_fc_mode(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("FC Mode")); @@ -2436,7 +2501,6 @@ void UI_func_fc_mode(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2451,6 +2515,7 @@ void UI_func_bc_range(uint8_t param) { 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); @@ -2480,7 +2545,6 @@ void UI_func_bc_range(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2495,6 +2559,7 @@ void UI_func_bc_assign(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("BC Assign")); @@ -2550,7 +2615,6 @@ void UI_func_bc_assign(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2565,6 +2629,7 @@ void UI_func_bc_mode(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("BC Mode")); @@ -2606,7 +2671,6 @@ void UI_func_bc_mode(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2621,6 +2685,7 @@ void UI_func_at_range(uint8_t param) { 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); @@ -2650,7 +2715,6 @@ void UI_func_at_range(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2665,6 +2729,7 @@ void UI_func_at_assign(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("AT Assign")); @@ -2720,7 +2785,6 @@ void UI_func_at_assign(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2735,6 +2799,7 @@ void UI_func_at_mode(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("AT Mode")); @@ -2776,7 +2841,6 @@ void UI_func_at_mode(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2791,6 +2855,7 @@ void UI_func_portamento_mode(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("Portamento Mode")); @@ -2834,7 +2899,6 @@ void UI_func_portamento_mode(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2849,6 +2913,7 @@ void UI_func_portamento_glissando(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("Portam. Gliss.")); @@ -2886,7 +2951,6 @@ void UI_func_portamento_glissando(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -2901,6 +2965,7 @@ void UI_func_portamento_time(uint8_t param) { 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); @@ -2930,7 +2995,6 @@ void UI_func_portamento_time(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -3002,6 +3066,7 @@ void UI_handle_OP(uint8_t param, uint8_t op, uint8_t instance_id) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("Operator ")); @@ -3054,7 +3119,6 @@ void UI_handle_OP(uint8_t param, uint8_t op, uint8_t instance_id) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -3066,6 +3130,7 @@ void UI_func_information(uint8_t param) encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; generate_version_string(version_string, sizeof(version_string)); @@ -3088,7 +3153,6 @@ void UI_func_information(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -3098,6 +3162,7 @@ void UI_func_midi_soft_thru(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; lcd.setCursor(0, 0); lcd.print(F("MIDI Soft THRU")); @@ -3132,7 +3197,6 @@ void UI_func_midi_soft_thru(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -3147,6 +3211,7 @@ void UI_func_velocity_level(uint8_t param) { 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); @@ -3175,7 +3240,6 @@ void UI_func_velocity_level(uint8_t param) lcd_special_chars(SCROLLBAR); eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -3187,6 +3251,7 @@ void UI_func_firmware_reset(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; // setup function lcd.print("Firmware reset?"); @@ -3234,7 +3299,6 @@ void UI_func_firmware_reset(uint8_t param) delay(500); } encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -3250,6 +3314,7 @@ void UI_func_voice_select(uint8_t param) { encoderDir[ENC_R].reset(); last_menu = LCDML.FUNC_getID(); + inside_menu = true; strip_extension(bank_names[instance_id][configuration.dexed[instance_id].bank], bank_name[instance_id]); @@ -3408,7 +3473,6 @@ void UI_func_voice_select(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } } @@ -3451,7 +3515,14 @@ void UI_func_volume(uint8_t param) eeprom_write(); encoderDir[ENC_L].reset(); - last_menu = 0xff; + + if (last_menu < 0xff && inside_menu == true) + LCDML.OTHER_jumpToID(last_menu); + else + { + LCDML.OTHER_setCursorToID(last_cursor); + LCDML.DISP_update(); + } } } @@ -3495,7 +3566,6 @@ void UI_func_load(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -3539,7 +3609,6 @@ void UI_func_save(uint8_t param) { eeprom_write(); encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -3563,7 +3632,6 @@ void UI_function_not_enabled(void) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - last_menu = 0xff; } } @@ -3587,7 +3655,6 @@ void UI_function_not_implemented(uint8_t param) if (LCDML.FUNC_close()) // ****** STABLE END ********* { encoderDir[ENC_R].reset(); - last_menu = 0xff; } } diff --git a/third-party/LCDMenuLib2/src/LCDMenuLib2_macros.h b/third-party/LCDMenuLib2/src/LCDMenuLib2_macros.h index 0096241..5a561af 100644 --- a/third-party/LCDMenuLib2/src/LCDMenuLib2_macros.h +++ b/third-party/LCDMenuLib2/src/LCDMenuLib2_macros.h @@ -108,7 +108,7 @@ LCDML_langDef(id, lcdml, p_content); \ LCDMenuLib2_menu parent ## _ ## child(id, p_param, p_settings, p_callback, p_condition ); \ void LCDML_DISP_ ## id ## _function() { \ - parent.addChild(parent ## _ ## child); \ + parent.addChild(parent ## _ ## child); \ } #define LCDML_add(id, parent, child, content, callback) \