Started to intertcept the back function for UI_func_drums_mini_note().

dev
Holger Wirtz 2 years ago
parent 193b0291f7
commit c407ee8194
  1. 28
      UI.hpp

@ -145,6 +145,7 @@ uint8_t orig_attack_values[2][7];
uint8_t orig_release_values[2][7]; uint8_t orig_release_values[2][7];
int temp_int; int temp_int;
float temp_float; float temp_float;
bool ask_before_quit = false;
#ifdef I2C_DISPLAY #ifdef I2C_DISPLAY
#include <LiquidCrystal_I2C.h> #include <LiquidCrystal_I2C.h>
@ -743,6 +744,11 @@ void lcdml_menu_control(void) {
LCDML.OTHER_jumpToID(LCDML.MENU_getLastActiveFunctionID()); LCDML.OTHER_jumpToID(LCDML.MENU_getLastActiveFunctionID());
else else
LCDML.OTHER_setCursorToID(LCDML.MENU_getLastCursorPositionID()); LCDML.OTHER_setCursorToID(LCDML.MENU_getLastCursorPositionID());
} else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_drum_midi_note) && ask_before_quit == false) {
ask_before_quit = true;
encoderDir[ENC_L].reset();
encoderDir[ENC_R].reset();
LCDML.OTHER_updateFunc();
} else } else
LCDML.BT_quit(); LCDML.BT_quit();
} }
@ -4394,6 +4400,18 @@ void UI_func_drum_midi_note(uint8_t param) {
if (LCDML.FUNC_loop()) // ****** LOOP ********* if (LCDML.FUNC_loop()) // ****** LOOP *********
{ {
if (ask_before_quit == true) {
if (store_flag == true) {
display.show(0, 0, LCD_cols, "Store changes?");
display.show(1, 0, LCD_cols, "[NO] YES");
delay(1000);
}
ask_before_quit = false;
LCDML.FUNC_goBackToMenu();
/*LCDML.BT_quit();
LCDML.OTHER_updateFunc();*/
}
if (midi_learn_mode >= DRUMS_MIDI_NOTE_MIN) if (midi_learn_mode >= DRUMS_MIDI_NOTE_MIN)
configuration.drums.midinote[active_sample] = midi_learn_mode; configuration.drums.midinote[active_sample] = midi_learn_mode;
@ -4402,17 +4420,17 @@ void UI_func_drum_midi_note(uint8_t param) {
if (display_name == true) { if (display_name == true) {
if (active_sample < NUM_DRUMSET_CONFIG - 2) if (active_sample < NUM_DRUMSET_CONFIG - 2)
active_sample++; active_sample++;
store_flag = true;
} else { } else {
configuration.drums.midinote[active_sample] = constrain(configuration.drums.midinote[active_sample] + ENCODER[ENC_L].speed(), DRUMS_MIDI_NOTE_MIN, DRUMS_MIDI_NOTE_MAX); configuration.drums.midinote[active_sample] = constrain(configuration.drums.midinote[active_sample] + ENCODER[ENC_L].speed(), DRUMS_MIDI_NOTE_MIN, DRUMS_MIDI_NOTE_MAX);
store_flag = true;
} }
} else if (LCDML.BT_checkUp()) { } else if (LCDML.BT_checkUp()) {
if (display_name == true) { if (display_name == true) {
if (active_sample > 0) if (active_sample > 0)
active_sample--; active_sample--;
store_flag = true;
} else { } else {
configuration.drums.midinote[active_sample] = constrain(configuration.drums.midinote[active_sample] - ENCODER[ENC_L].speed(), DRUMS_MIDI_NOTE_MIN, DRUMS_MIDI_NOTE_MAX); configuration.drums.midinote[active_sample] = constrain(configuration.drums.midinote[active_sample] - ENCODER[ENC_L].speed(), DRUMS_MIDI_NOTE_MIN, DRUMS_MIDI_NOTE_MAX);
store_flag = true;
} }
} else if (LCDML.BT_checkEnter()) { } else if (LCDML.BT_checkEnter()) {
display_name = !display_name; display_name = !display_name;
@ -4438,10 +4456,6 @@ void UI_func_drum_midi_note(uint8_t param) {
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********
{ {
if (store_flag == true) {
display.show(0, 0, LCD_cols, "Store changes?");
display.show(1, 0, LCD_cols, "[NO] YES");
}
encoderDir[ENC_L].reset(); encoderDir[ENC_L].reset();
midi_learn_mode = MIDI_LEARN_MODE_OFF; midi_learn_mode = MIDI_LEARN_MODE_OFF;
} }
@ -6792,4 +6806,4 @@ void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id) {
char* basename(const char* filename) { char* basename(const char* filename) {
char* p = strrchr(filename, '/'); char* p = strrchr(filename, '/');
return p ? p + 1 : (char*)filename; return p ? p + 1 : (char*)filename;
} }

Loading…
Cancel
Save