From 9e5e171feceb01a7268e8df343ad66e6ae47af03 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Thu, 9 Feb 2023 14:09:02 +0100 Subject: [PATCH] Added display of selection function for drum midi notes. --- UI.hpp | 53 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/UI.hpp b/UI.hpp index eb3ad59..21f355f 100644 --- a/UI.hpp +++ b/UI.hpp @@ -3856,6 +3856,49 @@ void UI_handle_OP(uint8_t param) { } #if NUM_DRUMS > 0 +void _check_yes_no_back(uint8_t state) { + if (state == 0) { // BACK + display.setCursor(0, 1); + display.print(F(" ")); + display.setCursor(3, 1); + display.print(F(" ")); + display.setCursor(4, 1); + display.print(F(" ")); + display.setCursor(8, 1); + display.print(F(" ")); + display.setCursor(9, 1); + display.print(F("[")); + display.setCursor(14, 1); + display.print(F("] ")); + } else if (state == 1) { // NO + display.setCursor(0, 1); + display.print(F("[")); + display.setCursor(3, 1); + display.print(F("]")); + display.setCursor(4, 1); + display.print(F(" ")); + display.setCursor(8, 1); + display.print(F(" ")); + display.setCursor(9, 1); + display.print(F(" ")); + display.setCursor(14, 1); + display.print(F(" ")); + } else { // YES + display.setCursor(0, 1); + display.print(F(" ")); + display.setCursor(3, 1); + display.print(F(" ")); + display.setCursor(4, 1); + display.print(F("[")); + display.setCursor(8, 1); + display.print(F("]")); + display.setCursor(9, 1); + display.print(F(" ")); + display.setCursor(14, 1); + display.print(F(" ")); + } +} + void _check_display_name(bool display_name, uint8_t digits) { if (display_name == true) { display.setCursor(0, 1); @@ -4413,9 +4456,8 @@ void UI_func_drum_midi_note(uint8_t param) { num_changes++; } if (num_changes > 0) { - display.show(0, 0, LCD_cols, "Store changes?"); - display.show(1, 0, LCD_cols, " NO YES [BACK]"); ask_before_quit_mode = 0; + _check_yes_no_back(ask_before_quit_mode); } else { ask_before_quit = false; LCDML.FUNC_goBackToMenu(); @@ -4432,24 +4474,23 @@ void UI_func_drum_midi_note(uint8_t param) { active_sample++; } else if (ask_before_quit_mode >= 0) { ++ask_before_quit_mode %= 3; - // TODO: Display selection is missing + _check_yes_no_back(ask_before_quit_mode); } else { configuration.drums.midinote[active_sample] = constrain(configuration.drums.midinote[active_sample] + ENCODER[ENC_L].speed(), DRUMS_MIDI_NOTE_MIN, DRUMS_MIDI_NOTE_MAX); } - } else if (LCDML.BT_checkUp()) { if (display_name == true) { if (active_sample > 0) active_sample--; } else if (ask_before_quit_mode >= 0) { --ask_before_quit_mode %= 3; - // TODO: Display selection is missing + _check_yes_no_back(ask_before_quit_mode); } else { configuration.drums.midinote[active_sample] = constrain(configuration.drums.midinote[active_sample] - ENCODER[ENC_L].speed(), DRUMS_MIDI_NOTE_MIN, DRUMS_MIDI_NOTE_MAX); } } else if (LCDML.BT_checkEnter()) { if (ask_before_quit_mode >= 0) { - if (ask_before_quit_mode == 0) { //NO + if (ask_before_quit_mode == 0) { // NO ask_before_quit = false; LCDML.FUNC_goBackToMenu(); } else if (ask_before_quit_mode == 1) { // YES