Fixing menu selection.

pull/3/head
Holger Wirtz 5 years ago
parent ce0b93943f
commit c832fdd2d8
  1. 2
      MicroDexed.ino
  2. 128
      UI.hpp

@ -144,7 +144,7 @@ void setup()
// Enable Menu Rollover // Enable Menu Rollover
//LCDML.MENU_enRollover(); //LCDML.MENU_enRollover();
// Enable Screensaver (screensaver menu function, time to activate in ms) // Enable Screensaver (screensaver menu function, time to activate in ms)
//LCDML.SCREEN_enable(UI_func_screensaver, 10000); // set to 10 seconds //LCDML.SCREEN_enable(UI_voice_func_voice_selection, 10000); // set to 10 seconds
#else #else
Serial.println(F("NO LCD DISPLAY ENABLED!")); Serial.println(F("NO LCD DISPLAY ENABLED!"));
#endif #endif

128
UI.hpp

@ -76,6 +76,8 @@ void UI_func_stereo_mono(uint8_t param);
void UI_func_polyphony(uint8_t param); void UI_func_polyphony(uint8_t param);
void UI_func_engine(uint8_t param); void UI_func_engine(uint8_t param);
void UI_func_information(uint8_t param); void UI_func_information(uint8_t param);
void UI_voice_func_bank_selection(uint8_t param);
void UI_voice_func_voice_selection(uint8_t param);
void UI_func_back(uint8_t param); void UI_func_back(uint8_t param);
void UI_func_goToRootMenu(uint8_t param); void UI_func_goToRootMenu(uint8_t param);
@ -114,8 +116,8 @@ LCDML_add(22, LCDML_0_4, 4, "Stereo/Mono", UI_func_stereo_mono);
LCDML_add(23, LCDML_0_4, 5, "Polyphony", UI_func_polyphony); LCDML_add(23, LCDML_0_4, 5, "Polyphony", UI_func_polyphony);
LCDML_add(24, LCDML_0_4, 6, "Engine", UI_func_engine); LCDML_add(24, LCDML_0_4, 6, "Engine", UI_func_engine);
LCDML_add(25, LCDML_0, 5, "Info", UI_func_information); LCDML_add(25, LCDML_0, 5, "Info", UI_func_information);
LCDML_add(26, LCDML_1, 1, "Bank", NULL); LCDML_add(26, LCDML_1, 1, "B01:DEFAULT", UI_voice_func_bank_selection);
LCDML_add(27, LCDML_1, 2, "Voice", NULL); LCDML_add(27, LCDML_1, 2, "V01:INIT", UI_voice_func_voice_selection);
#define _LCDML_DISP_cnt 27 #define _LCDML_DISP_cnt 27
// create menu // create menu
@ -204,74 +206,6 @@ void lcdml_menu_control(void)
} }
} }
/*
void lcdml_menu_control(void)
{
// If something must init, put in in the setup condition
if (LCDML.BT_setup())
{
pinMode(BUT_R_PIN, INPUT_PULLUP);
}
//Volatile Variable
long g_LCDML_CONTROL_Encoder_position = ENCODER[ENC_R].read();
bool button_r = digitalRead(BUT_R_PIN);
if (g_LCDML_CONTROL_Encoder_position <= -3) {
if (!button_r)
{
LCDML.BT_left();
g_LCDML_CONTROL_button_prev[ENC_R] = LOW;
g_LCDML_CONTROL_button_press_time[ENC_R] = -1;
}
else
{
LCDML.BT_down();
}
ENCODER[ENC_R].write(g_LCDML_CONTROL_Encoder_position + 4);
}
else if (g_LCDML_CONTROL_Encoder_position >= 3)
{
if (!button_r)
{
LCDML.BT_right();
g_LCDML_CONTROL_button_prev[ENC_R] = LOW;
g_LCDML_CONTROL_button_press_time[ENC_R] = -1;
}
else
{
LCDML.BT_up();
}
ENCODER[ENC_R].write(g_LCDML_CONTROL_Encoder_position - 4);
}
else
{
if (!button_r && g_LCDML_CONTROL_button_prev[ENC_R]) //falling edge, button_r pressed
{
g_LCDML_CONTROL_button_prev[ENC_R] = LOW;
g_LCDML_CONTROL_button_press_time[ENC_R] = millis();
}
else if (button_r && !g_LCDML_CONTROL_button_prev) //rising edge, button_r not active
{
g_LCDML_CONTROL_button_prev[ENC_R] = HIGH;
if (g_LCDML_CONTROL_button_press_time[ENC_R] < 0)
{
g_LCDML_CONTROL_button_press_time[ENC_R] = millis();
//Reset for left right action
}
else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= g_LCDML_CONTROL_button_long_press)
{
LCDML.BT_quit();
}
else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= g_LCDML_CONTROL_button_short_press)
{
LCDML.BT_enter();
}
}
}
}
*/
void lcdml_voice_menu_control(void) void lcdml_voice_menu_control(void)
{ {
// If something must init, put in in the setup condition // If something must init, put in in the setup condition
@ -709,6 +643,60 @@ void UI_func_information(uint8_t param)
} }
} }
void UI_voice_func_bank_selection(uint8_t param)
{
if (LCDML_Voice.FUNC_setup()) // ****** SETUP *********
{
// update LCD content
lcd.setCursor(0, 0); // set cursor
lcd.print("B01:DEFAULT"); // print change content
lcd.setCursor(0, 1); // set cursor
lcd.print("Select Bank");
LCDML_Voice.FUNC_setLoopInterval(100); // starts a trigger event for the loop function every 100 milliseconds
}
if (LCDML_Voice.FUNC_loop())
{
if (LCDML_Voice.BT_checkEnter()) // check if any button is pressed (enter, up, down, left, right)
{
LCDML_Voice.FUNC_goBackToMenu(); // leave this function
}
}
if (LCDML_Voice.FUNC_close())
{
// The screensaver go to the root menu
LCDML_Voice.MENU_goRoot();
}
}
void UI_voice_func_voice_selection(uint8_t param)
{
if (LCDML_Voice.FUNC_setup()) // ****** SETUP *********
{
// update LCD content
lcd.setCursor(0, 0); // set cursor
lcd.print("Select Voice"); // print change content
lcd.setCursor(0, 1); // set cursor
lcd.print("V01:INIT");
LCDML_Voice.FUNC_setLoopInterval(100); // starts a trigger event for the loop function every 100 milliseconds
}
if (LCDML_Voice.FUNC_loop())
{
if (LCDML_Voice.BT_checkEnter()) // check if any button is pressed (enter, up, down, left, right)
{
LCDML_Voice.FUNC_goBackToMenu(); // leave this function
}
}
if (LCDML_Voice.FUNC_close())
{
// The screensaver go to the root menu
LCDML_Voice.MENU_goRoot();
}
}
void UI_func_screensaver(uint8_t param) void UI_func_screensaver(uint8_t param)
{ {
if (LCDML.FUNC_setup()) // ****** SETUP ********* if (LCDML.FUNC_setup()) // ****** SETUP *********

Loading…
Cancel
Save