|
|
@ -26,10 +26,10 @@ |
|
|
|
#ifndef _UI_HPP_ |
|
|
|
#ifndef _UI_HPP_ |
|
|
|
#define _UI_HPP_ |
|
|
|
#define _UI_HPP_ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "config.h" |
|
|
|
#include <LiquidCrystal_I2C.h> |
|
|
|
#include <LiquidCrystal_I2C.h> |
|
|
|
#include <LCDMenuLib2.h> |
|
|
|
#include <LCDMenuLib2.h> |
|
|
|
#include <Encoder.h> |
|
|
|
#include <Encoder.h> |
|
|
|
#include "config.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define _LCDML_DISP_cols LCD_cols |
|
|
|
#define _LCDML_DISP_cols LCD_cols |
|
|
|
#define _LCDML_DISP_rows LCD_rows |
|
|
|
#define _LCDML_DISP_rows LCD_rows |
|
|
@ -51,6 +51,8 @@ const uint8_t scroll_bar[5][8] = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
enum { ENC_R, ENC_L }; |
|
|
|
enum { ENC_R, ENC_L }; |
|
|
|
|
|
|
|
enum { MENU_R_SHOW, MENU_R_EDIT}; |
|
|
|
|
|
|
|
uint8_t menu_state = MENU_R_SHOW; |
|
|
|
|
|
|
|
|
|
|
|
void lcdml_menu_display(void); |
|
|
|
void lcdml_menu_display(void); |
|
|
|
void lcdml_voice_menu_display(void); |
|
|
|
void lcdml_voice_menu_display(void); |
|
|
@ -76,8 +78,7 @@ 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_func_voice_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); |
|
|
|
|
|
|
|
|
|
|
@ -85,10 +86,6 @@ void UI_func_goToRootMenu(uint8_t param); |
|
|
|
LCDMenuLib2_menu LCDML_0(255, 0, 0, NULL, NULL); // normal root menu element (do not change)
|
|
|
|
LCDMenuLib2_menu LCDML_0(255, 0, 0, NULL, NULL); // normal root menu element (do not change)
|
|
|
|
LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control); |
|
|
|
LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_display, lcdml_menu_clear, lcdml_menu_control); |
|
|
|
|
|
|
|
|
|
|
|
// voice menu
|
|
|
|
|
|
|
|
LCDMenuLib2_menu LCDML_1(255, 0, 0, NULL, NULL); // voice root menu element (do not change)
|
|
|
|
|
|
|
|
LCDMenuLib2 LCDML_Voice(LCDML_1, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_voice_menu_display, lcdml_menu_clear, lcdml_voice_menu_control); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// LCDML_add(id, prev_layer, new_num, lang_char_array, callback_function)
|
|
|
|
// LCDML_add(id, prev_layer, new_num, lang_char_array, callback_function)
|
|
|
|
LCDML_add(0, LCDML_0, 1, "Sound", UI_func_sound); |
|
|
|
LCDML_add(0, LCDML_0, 1, "Sound", UI_func_sound); |
|
|
|
LCDML_add(1, LCDML_0, 2, "Effect", NULL); |
|
|
|
LCDML_add(1, LCDML_0, 2, "Effect", NULL); |
|
|
@ -116,9 +113,7 @@ 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, "B01:DEFAULT", UI_voice_func_bank_selection); |
|
|
|
#define _LCDML_DISP_cnt 25 |
|
|
|
LCDML_add(27, LCDML_1, 2, "V01:INIT", UI_voice_func_voice_selection); |
|
|
|
|
|
|
|
#define _LCDML_DISP_cnt 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// create menu
|
|
|
|
// create menu
|
|
|
|
LCDML_createMenu(_LCDML_DISP_cnt); |
|
|
|
LCDML_createMenu(_LCDML_DISP_cnt); |
|
|
@ -134,24 +129,23 @@ Encoder ENCODER[NUM_ENCODER] = {Encoder(ENC_R_PIN_B, ENC_R_PIN_A), Encoder(ENC_L |
|
|
|
|
|
|
|
|
|
|
|
long g_LCDML_CONTROL_button_press_time[NUM_ENCODER] = {0, 0}; |
|
|
|
long g_LCDML_CONTROL_button_press_time[NUM_ENCODER] = {0, 0}; |
|
|
|
bool g_LCDML_CONTROL_button_prev[NUM_ENCODER] = {HIGH, HIGH}; |
|
|
|
bool g_LCDML_CONTROL_button_prev[NUM_ENCODER] = {HIGH, HIGH}; |
|
|
|
|
|
|
|
uint8_t g_LCDML_CONTROL_prev[NUM_ENCODER] = {0, 0}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void lcdml_menu_control(void) |
|
|
|
void lcdml_menu_control(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// If something must init, put in in the setup condition
|
|
|
|
// If something must init, put in in the setup condition
|
|
|
|
if(LCDML.BT_setup()) |
|
|
|
if (LCDML.BT_setup()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pinMode(BUT_R_PIN, INPUT_PULLUP); |
|
|
|
pinMode(BUT_R_PIN, INPUT_PULLUP); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Volatile Variable
|
|
|
|
//Volatile Variable
|
|
|
|
long g_LCDML_CONTROL_Encoder_position = ENCODER[ENC_R].read(); |
|
|
|
long g_LCDML_CONTROL_Encoder_position[NUM_ENCODER] = {ENCODER[ENC_R].read(), ENCODER[ENC_L].read()}; |
|
|
|
bool button = digitalRead(BUT_R_PIN); |
|
|
|
bool button[NUM_ENCODER] = {digitalRead(BUT_R_PIN), digitalRead(BUT_L_PIN)}; |
|
|
|
|
|
|
|
|
|
|
|
if(g_LCDML_CONTROL_Encoder_position <= -3) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!button) |
|
|
|
if (g_LCDML_CONTROL_Encoder_position[ENC_R] <= -3) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!button[ENC_R]) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LCDML.BT_left(); |
|
|
|
LCDML.BT_left(); |
|
|
|
g_LCDML_CONTROL_button_prev[ENC_R] = LOW; |
|
|
|
g_LCDML_CONTROL_button_prev[ENC_R] = LOW; |
|
|
@ -159,14 +153,15 @@ void lcdml_menu_control(void) |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
LCDML.BT_down(); |
|
|
|
if (menu_state == MENU_R_SHOW) |
|
|
|
|
|
|
|
LCDML.BT_down(); |
|
|
|
} |
|
|
|
} |
|
|
|
ENCODER[ENC_R].write(g_LCDML_CONTROL_Encoder_position+4); |
|
|
|
ENCODER[ENC_R].write(g_LCDML_CONTROL_Encoder_position[ENC_R] + 4); |
|
|
|
} |
|
|
|
} |
|
|
|
else if(g_LCDML_CONTROL_Encoder_position >= 3) |
|
|
|
else if (g_LCDML_CONTROL_Encoder_position[ENC_R] >= 3) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
if(!button) |
|
|
|
if (!button[ENC_R]) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LCDML.BT_right(); |
|
|
|
LCDML.BT_right(); |
|
|
|
g_LCDML_CONTROL_button_prev[ENC_R] = LOW; |
|
|
|
g_LCDML_CONTROL_button_prev[ENC_R] = LOW; |
|
|
@ -174,104 +169,55 @@ void lcdml_menu_control(void) |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
LCDML.BT_up(); |
|
|
|
if (menu_state == MENU_R_SHOW) |
|
|
|
|
|
|
|
LCDML.BT_up(); |
|
|
|
} |
|
|
|
} |
|
|
|
ENCODER[ENC_R].write(g_LCDML_CONTROL_Encoder_position-4); |
|
|
|
ENCODER[ENC_R].write(g_LCDML_CONTROL_Encoder_position[ENC_R] - 4); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(!button && g_LCDML_CONTROL_button_prev[ENC_R]) //falling edge, button pressed
|
|
|
|
if (!button[ENC_R] && g_LCDML_CONTROL_button_prev[ENC_R]) //falling edge, button[ENC_R] pressed
|
|
|
|
{ |
|
|
|
{ |
|
|
|
g_LCDML_CONTROL_button_prev[ENC_R] = LOW; |
|
|
|
g_LCDML_CONTROL_button_prev[ENC_R] = LOW; |
|
|
|
g_LCDML_CONTROL_button_press_time[ENC_R] = millis(); |
|
|
|
g_LCDML_CONTROL_button_press_time[ENC_R] = millis(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if(button && !g_LCDML_CONTROL_button_prev[ENC_R]) //rising edge, button not active
|
|
|
|
else if (button[ENC_R] && !g_LCDML_CONTROL_button_prev[ENC_R]) //rising edge, button[ENC_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) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// If something must init, put in in the setup condition
|
|
|
|
|
|
|
|
if (LCDML_Voice.BT_setup()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
pinMode(BUT_L_PIN, INPUT_PULLUP); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Volatile Variable
|
|
|
|
|
|
|
|
long g_LCDML_CONTROL_Encoder_position = ENCODER[ENC_L].read(); |
|
|
|
|
|
|
|
bool button_l = digitalRead(BUT_L_PIN); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (g_LCDML_CONTROL_Encoder_position <= -3) { |
|
|
|
|
|
|
|
if (!button_l) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
LCDML_Voice.BT_left(); |
|
|
|
|
|
|
|
g_LCDML_CONTROL_button_prev[ENC_L] = LOW; |
|
|
|
|
|
|
|
g_LCDML_CONTROL_button_press_time[ENC_L] = -1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
LCDML_Voice.BT_down(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ENCODER[ENC_L].write(g_LCDML_CONTROL_Encoder_position + 4); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (g_LCDML_CONTROL_Encoder_position >= 3) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!button_l) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
LCDML_Voice.BT_right(); |
|
|
|
|
|
|
|
g_LCDML_CONTROL_button_prev[ENC_L] = LOW; |
|
|
|
|
|
|
|
g_LCDML_CONTROL_button_press_time[ENC_L] = -1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
LCDML_Voice.BT_up(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ENCODER[ENC_L].write(g_LCDML_CONTROL_Encoder_position - 4); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!button_l && g_LCDML_CONTROL_button_prev[ENC_L]) //falling edge, button_l pressed
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
g_LCDML_CONTROL_button_prev[ENC_L] = LOW; |
|
|
|
|
|
|
|
g_LCDML_CONTROL_button_press_time[ENC_L] = millis(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (button_l && !g_LCDML_CONTROL_button_prev[ENC_L]) //rising edge, button_l not active
|
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
g_LCDML_CONTROL_button_prev[ENC_L] = HIGH; |
|
|
|
g_LCDML_CONTROL_button_prev[ENC_R] = HIGH; |
|
|
|
|
|
|
|
|
|
|
|
if (g_LCDML_CONTROL_button_press_time[ENC_L] < 0) |
|
|
|
if (g_LCDML_CONTROL_button_press_time[ENC_R] < 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
g_LCDML_CONTROL_button_press_time[ENC_L] = millis(); |
|
|
|
g_LCDML_CONTROL_button_press_time[ENC_R] = millis(); |
|
|
|
//Reset for left right action
|
|
|
|
//Reset for left right action
|
|
|
|
} |
|
|
|
} |
|
|
|
else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_L]) >= g_LCDML_CONTROL_button_long_press) |
|
|
|
else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= g_LCDML_CONTROL_button_long_press) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LCDML_Voice.BT_quit(); |
|
|
|
LCDML.BT_quit(); |
|
|
|
} |
|
|
|
} |
|
|
|
else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_L]) >= g_LCDML_CONTROL_button_short_press) |
|
|
|
else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= g_LCDML_CONTROL_button_short_press) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Serial.println("------------------------------------------------->LLLLLLLLLLLLLLLLLLLLLLLLLLLLL"); |
|
|
|
LCDML.BT_enter(); |
|
|
|
LCDML_Voice.BT_enter(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
// checking encoder left (volume)
|
|
|
|
|
|
|
|
if (g_LCDML_CONTROL_old_var[ENC_L] != g_LCDML_CONTROL_Encoder_position[ENC_L]) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (g_LCDML_CONTROL_Encoder_position[ENC_L] <= -3) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.println(F("Volume +")); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (g_LCDML_CONTROL_Encoder_position[ENC_L] >= 3) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.println(F("Volume -")); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
g_LCDML_CONTROL_old_var[ENC_L] = g_LCDML_CONTROL_Encoder_position[ENC_L]; |
|
|
|
|
|
|
|
}*/ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
/***********************************************************************
|
|
|
@ -344,7 +290,6 @@ void lcdml_menu_display(void) |
|
|
|
uint8_t scrollbar_cur_pos = LCDML.MENU_getCursorPosAbs(); |
|
|
|
uint8_t scrollbar_cur_pos = LCDML.MENU_getCursorPosAbs(); |
|
|
|
uint8_t scroll_pos = ((1.*n_max * _LCDML_DISP_rows) / (scrollbar_max - 1) * scrollbar_cur_pos); |
|
|
|
uint8_t scroll_pos = ((1.*n_max * _LCDML_DISP_rows) / (scrollbar_max - 1) * scrollbar_cur_pos); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// display rows
|
|
|
|
// display rows
|
|
|
|
for (uint8_t n = 0; n < n_max; n++) |
|
|
|
for (uint8_t n = 0; n < n_max; n++) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -393,116 +338,6 @@ void lcdml_menu_display(void) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void lcdml_voice_menu_display(void) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// update content
|
|
|
|
|
|
|
|
// ***************
|
|
|
|
|
|
|
|
if (LCDML_Voice.DISP_checkMenuUpdate()) { |
|
|
|
|
|
|
|
// clear menu
|
|
|
|
|
|
|
|
// ***************
|
|
|
|
|
|
|
|
LCDML_Voice.DISP_clear(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// declaration of some variables
|
|
|
|
|
|
|
|
// ***************
|
|
|
|
|
|
|
|
// content variable
|
|
|
|
|
|
|
|
char content_text[_LCDML_DISP_cols]; // save the content text of every menu element
|
|
|
|
|
|
|
|
// menu element object
|
|
|
|
|
|
|
|
LCDMenuLib2_menu *tmp; |
|
|
|
|
|
|
|
// some limit values
|
|
|
|
|
|
|
|
uint8_t i = LCDML_Voice.MENU_getScroll(); |
|
|
|
|
|
|
|
uint8_t maxi = _LCDML_DISP_rows + i; |
|
|
|
|
|
|
|
uint8_t n = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check if this element has children
|
|
|
|
|
|
|
|
if ((tmp = LCDML_Voice.MENU_getDisplayedObj()) != NULL) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// loop to display lines
|
|
|
|
|
|
|
|
do |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// check if a menu element has a condition and if the condition be true
|
|
|
|
|
|
|
|
if (tmp->checkCondition()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// check the type off a menu element
|
|
|
|
|
|
|
|
if (tmp->checkType_menu() == true) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// display normal content
|
|
|
|
|
|
|
|
LCDML_getContent(content_text, tmp->getID()); |
|
|
|
|
|
|
|
lcd.setCursor(1, n); |
|
|
|
|
|
|
|
lcd.print(content_text); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (tmp->checkType_dynParam()) { |
|
|
|
|
|
|
|
tmp->callback(n); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// increment some values
|
|
|
|
|
|
|
|
i++; |
|
|
|
|
|
|
|
n++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// try to go to the next sibling and check the number of displayed rows
|
|
|
|
|
|
|
|
} while (((tmp = tmp->getSibling(1)) != NULL) && (i < maxi)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (LCDML_Voice.DISP_checkMenuCursorUpdate()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// init vars
|
|
|
|
|
|
|
|
uint8_t n_max = (LCDML_Voice.MENU_getChilds() >= _LCDML_DISP_rows) ? _LCDML_DISP_rows : (LCDML_Voice.MENU_getChilds()); |
|
|
|
|
|
|
|
uint8_t scrollbar_min = 0; |
|
|
|
|
|
|
|
uint8_t scrollbar_max = LCDML_Voice.MENU_getChilds(); |
|
|
|
|
|
|
|
uint8_t scrollbar_cur_pos = LCDML_Voice.MENU_getCursorPosAbs(); |
|
|
|
|
|
|
|
uint8_t scroll_pos = ((1.*n_max * _LCDML_DISP_rows) / (scrollbar_max - 1) * scrollbar_cur_pos); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// display rows
|
|
|
|
|
|
|
|
for (uint8_t n = 0; n < n_max; n++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
//set cursor
|
|
|
|
|
|
|
|
lcd.setCursor(0, n); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//set cursor char
|
|
|
|
|
|
|
|
if (n == LCDML_Voice.MENU_getCursorPos()) { |
|
|
|
|
|
|
|
lcd.write(_LCDML_DISP_cfg_cursor); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
lcd.write(' '); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// delete or reset scrollbar
|
|
|
|
|
|
|
|
if (_LCDML_DISP_cfg_scrollbar == 1) { |
|
|
|
|
|
|
|
if (scrollbar_max > n_max) { |
|
|
|
|
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), n); |
|
|
|
|
|
|
|
lcd.write((uint8_t)0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), n); |
|
|
|
|
|
|
|
lcd.print(' '); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// display scrollbar
|
|
|
|
|
|
|
|
if (_LCDML_DISP_cfg_scrollbar == 1) { |
|
|
|
|
|
|
|
if (scrollbar_max > n_max) { |
|
|
|
|
|
|
|
//set scroll position
|
|
|
|
|
|
|
|
if (scrollbar_cur_pos == scrollbar_min) { |
|
|
|
|
|
|
|
// min pos
|
|
|
|
|
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), 0); |
|
|
|
|
|
|
|
lcd.write((uint8_t)1); |
|
|
|
|
|
|
|
} else if (scrollbar_cur_pos == (scrollbar_max - 1)) { |
|
|
|
|
|
|
|
// max pos
|
|
|
|
|
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), (n_max - 1)); |
|
|
|
|
|
|
|
lcd.write((uint8_t)4); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// between
|
|
|
|
|
|
|
|
lcd.setCursor((_LCDML_DISP_cols - 1), scroll_pos / n_max); |
|
|
|
|
|
|
|
lcd.write((uint8_t)(scroll_pos % n_max) + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
/***********************************************************************
|
|
|
|
MENU |
|
|
|
MENU |
|
|
|
***********************************************************************/ |
|
|
|
***********************************************************************/ |
|
|
@ -643,61 +478,7 @@ void UI_func_information(uint8_t param) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UI_voice_func_bank_selection(uint8_t param) |
|
|
|
void UI_func_voice_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) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if (LCDML.FUNC_setup()) // ****** SETUP *********
|
|
|
|
if (LCDML.FUNC_setup()) // ****** SETUP *********
|
|
|
|
{ |
|
|
|
{ |
|
|
|