|
|
|
@ -76,6 +76,14 @@ void lcdml_menu_display(void); |
|
|
|
|
void lcdml_voice_menu_display(void); |
|
|
|
|
void lcdml_menu_clear(void); |
|
|
|
|
void lcdml_menu_control(void); |
|
|
|
|
void encoder_right_up(void); |
|
|
|
|
void encoder_right_down(void); |
|
|
|
|
void encoder_right_button_long(void); |
|
|
|
|
void encoder_right_button_short(void); |
|
|
|
|
void encoder_left_up(void); |
|
|
|
|
void encoder_left_down(void); |
|
|
|
|
void encoder_left_button_long(void); |
|
|
|
|
void encoder_left_button_short(void); |
|
|
|
|
void lcdml_voice_menu_control(void); |
|
|
|
|
void UI_func_sound(uint8_t param); |
|
|
|
|
void UI_func_reverb_roomsize(uint8_t param); |
|
|
|
@ -170,8 +178,9 @@ void lcdml_menu_control(void) |
|
|
|
|
bool button[NUM_ENCODER] = {digitalRead(BUT_R_PIN), digitalRead(BUT_L_PIN)}; |
|
|
|
|
|
|
|
|
|
/************************************************************************************
|
|
|
|
|
Right encoder |
|
|
|
|
Basic encoder handlying (from LCDMenuLib2 |
|
|
|
|
************************************************************************************/ |
|
|
|
|
// RIGHT
|
|
|
|
|
if (g_LCDML_CONTROL_Encoder_position[ENC_R] <= -3) |
|
|
|
|
{ |
|
|
|
|
if (!button[ENC_R]) |
|
|
|
@ -182,45 +191,7 @@ void lcdml_menu_control(void) |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
switch (menu_state) |
|
|
|
|
{ |
|
|
|
|
case MENU_EDIT: |
|
|
|
|
case MENU_VOLUME: |
|
|
|
|
menu_state = MENU_EDIT; |
|
|
|
|
LCDML.BT_down(); |
|
|
|
|
break; |
|
|
|
|
case MENU_VOICE: |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("State: MENU_VOICE, Encoder left up")); |
|
|
|
|
#endif |
|
|
|
|
switch (menu_voice) |
|
|
|
|
{ |
|
|
|
|
case MENU_VOICE_BANK: |
|
|
|
|
if (configuration.bank < MAX_BANKS) |
|
|
|
|
{ |
|
|
|
|
configuration.bank++; |
|
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case MENU_VOICE_SOUND: |
|
|
|
|
if (configuration.voice < MAX_VOICES) |
|
|
|
|
configuration.voice++; |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if (configuration.bank < MAX_BANKS) |
|
|
|
|
{ |
|
|
|
|
configuration.bank++; |
|
|
|
|
configuration.voice = 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
|
eeprom_write(); |
|
|
|
|
} |
|
|
|
|
UI_func_voice_selection(0); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
encoder_right_up(); |
|
|
|
|
} |
|
|
|
|
ENCODER[ENC_R].write(g_LCDML_CONTROL_Encoder_position[ENC_R] + 4); |
|
|
|
|
} |
|
|
|
@ -235,45 +206,7 @@ void lcdml_menu_control(void) |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
switch (menu_state) |
|
|
|
|
{ |
|
|
|
|
case MENU_EDIT: |
|
|
|
|
case MENU_VOLUME: |
|
|
|
|
menu_state = MENU_EDIT; |
|
|
|
|
LCDML.BT_up(); |
|
|
|
|
break; |
|
|
|
|
case MENU_VOICE: |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("State: MENU_VOICE, Encoder left down")); |
|
|
|
|
#endif |
|
|
|
|
switch (menu_voice) |
|
|
|
|
{ |
|
|
|
|
case MENU_VOICE_BANK: |
|
|
|
|
if (configuration.bank > 0) |
|
|
|
|
{ |
|
|
|
|
configuration.bank--; |
|
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case MENU_VOICE_SOUND: |
|
|
|
|
if (configuration.voice > 0) |
|
|
|
|
configuration.voice--; |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if (configuration.bank > 0) |
|
|
|
|
{ |
|
|
|
|
configuration.bank--; |
|
|
|
|
configuration.voice = 31; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
|
eeprom_write(); |
|
|
|
|
} |
|
|
|
|
UI_func_voice_selection(0); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
encoder_right_down(); |
|
|
|
|
} |
|
|
|
|
ENCODER[ENC_R].write(g_LCDML_CONTROL_Encoder_position[ENC_R] - 4); |
|
|
|
|
} |
|
|
|
@ -302,35 +235,16 @@ void lcdml_menu_control(void) |
|
|
|
|
} |
|
|
|
|
else if (menu_state == MENU_VOICE) |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("State: MENU_VOICE, button long press")); |
|
|
|
|
#endif |
|
|
|
|
encoder_right_button_long(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= g_LCDML_CONTROL_button_short_press) |
|
|
|
|
{ |
|
|
|
|
if (menu_state == MENU_EDIT) |
|
|
|
|
{ |
|
|
|
|
LCDML.BT_enter(); |
|
|
|
|
} |
|
|
|
|
else if (menu_state == MENU_VOICE) |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("State: MENU_VOICE, button short press")); |
|
|
|
|
#endif |
|
|
|
|
if (menu_voice == MENU_VOICE_BANK) |
|
|
|
|
menu_voice = MENU_VOICE_SOUND; |
|
|
|
|
else |
|
|
|
|
menu_voice = MENU_VOICE_BANK; |
|
|
|
|
UI_func_voice_selection(0); |
|
|
|
|
} |
|
|
|
|
encoder_right_button_short(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/************************************************************************************
|
|
|
|
|
Left encoder |
|
|
|
|
************************************************************************************/ |
|
|
|
|
// LEFT
|
|
|
|
|
if (g_LCDML_CONTROL_Encoder_position[ENC_L] <= -3) |
|
|
|
|
{ |
|
|
|
|
if (!button[ENC_L]) |
|
|
|
@ -341,16 +255,7 @@ void lcdml_menu_control(void) |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("Volume +")); |
|
|
|
|
#endif |
|
|
|
|
if (configuration.vol < 0.96) |
|
|
|
|
{ |
|
|
|
|
soften_volume.diff = 0.05 / SOFTEN_VALUE_CHANGE_STEPS; |
|
|
|
|
soften_volume.steps = SOFTEN_VALUE_CHANGE_STEPS; |
|
|
|
|
eeprom_write(); |
|
|
|
|
} |
|
|
|
|
UI_func_volume(0); |
|
|
|
|
encoder_left_up(); |
|
|
|
|
} |
|
|
|
|
ENCODER[ENC_L].write(g_LCDML_CONTROL_Encoder_position[ENC_L] + 4); |
|
|
|
|
} |
|
|
|
@ -365,16 +270,7 @@ void lcdml_menu_control(void) |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("Volume -")); |
|
|
|
|
#endif |
|
|
|
|
if (configuration.vol > 0.04) |
|
|
|
|
{ |
|
|
|
|
soften_volume.diff = -0.05 / SOFTEN_VALUE_CHANGE_STEPS; |
|
|
|
|
soften_volume.steps = SOFTEN_VALUE_CHANGE_STEPS; |
|
|
|
|
eeprom_write(); |
|
|
|
|
} |
|
|
|
|
UI_func_volume(0); |
|
|
|
|
encoder_left_down(); |
|
|
|
|
} |
|
|
|
|
ENCODER[ENC_L].write(g_LCDML_CONTROL_Encoder_position[ENC_L] - 4); |
|
|
|
|
} |
|
|
|
@ -397,28 +293,191 @@ void lcdml_menu_control(void) |
|
|
|
|
else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_L]) >= g_LCDML_CONTROL_button_long_press) |
|
|
|
|
{ |
|
|
|
|
//LCDML.BT_quit();
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("Encoder left long press")); |
|
|
|
|
#endif |
|
|
|
|
encoder_left_button_long(); |
|
|
|
|
} |
|
|
|
|
else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_L]) >= g_LCDML_CONTROL_button_short_press) |
|
|
|
|
{ |
|
|
|
|
//LCDML.BT_enter();
|
|
|
|
|
encoder_left_button_short(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/************************************************************************************
|
|
|
|
|
RIGHT Encoder functions |
|
|
|
|
************************************************************************************/ |
|
|
|
|
void encoder_right_up(void) |
|
|
|
|
{ |
|
|
|
|
switch (menu_state) |
|
|
|
|
{ |
|
|
|
|
case MENU_EDIT: |
|
|
|
|
case MENU_VOLUME: |
|
|
|
|
menu_state = MENU_EDIT; |
|
|
|
|
LCDML.BT_down(); |
|
|
|
|
break; |
|
|
|
|
case MENU_VOICE: |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("Encoder left short press")); |
|
|
|
|
Serial.println(F("State: MENU_VOICE, Encoder left up")); |
|
|
|
|
#endif |
|
|
|
|
if (menu_state == MENU_EDIT) |
|
|
|
|
{ |
|
|
|
|
menu_state = MENU_VOICE; |
|
|
|
|
UI_func_voice_selection(0); |
|
|
|
|
} |
|
|
|
|
else if (menu_state == MENU_VOICE) |
|
|
|
|
{ |
|
|
|
|
menu_state = MENU_EDIT; |
|
|
|
|
LCDML.MENU_goRoot(); |
|
|
|
|
} |
|
|
|
|
switch (menu_voice) |
|
|
|
|
{ |
|
|
|
|
case MENU_VOICE_BANK: |
|
|
|
|
if (configuration.bank < MAX_BANKS) |
|
|
|
|
{ |
|
|
|
|
configuration.bank++; |
|
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case MENU_VOICE_SOUND: |
|
|
|
|
if (configuration.voice < MAX_VOICES) |
|
|
|
|
configuration.voice++; |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if (configuration.bank < MAX_BANKS) |
|
|
|
|
{ |
|
|
|
|
configuration.bank++; |
|
|
|
|
configuration.voice = 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
|
eeprom_write(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
UI_func_voice_selection(0); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void encoder_right_down(void) |
|
|
|
|
{ |
|
|
|
|
switch (menu_state) |
|
|
|
|
{ |
|
|
|
|
case MENU_EDIT: |
|
|
|
|
case MENU_VOLUME: |
|
|
|
|
menu_state = MENU_EDIT; |
|
|
|
|
LCDML.BT_up(); |
|
|
|
|
break; |
|
|
|
|
case MENU_VOICE: |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("State: MENU_VOICE, Encoder left down")); |
|
|
|
|
#endif |
|
|
|
|
switch (menu_voice) |
|
|
|
|
{ |
|
|
|
|
case MENU_VOICE_BANK: |
|
|
|
|
if (configuration.bank > 0) |
|
|
|
|
{ |
|
|
|
|
configuration.bank--; |
|
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case MENU_VOICE_SOUND: |
|
|
|
|
if (configuration.voice > 0) |
|
|
|
|
configuration.voice--; |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if (configuration.bank > 0) |
|
|
|
|
{ |
|
|
|
|
configuration.bank--; |
|
|
|
|
configuration.voice = 31; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
load_sysex(configuration.bank, configuration.voice); |
|
|
|
|
get_voice_names_from_bank(configuration.bank); |
|
|
|
|
eeprom_write(); |
|
|
|
|
} |
|
|
|
|
UI_func_voice_selection(0); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void encoder_right_button_long(void) |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("State: MENU_VOICE, button long press")); |
|
|
|
|
#else |
|
|
|
|
; |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void encoder_right_button_short(void) |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("Encoder right short press")); |
|
|
|
|
#endif |
|
|
|
|
if (menu_state == MENU_EDIT) |
|
|
|
|
{ |
|
|
|
|
LCDML.BT_enter(); |
|
|
|
|
} |
|
|
|
|
else if (menu_state == MENU_VOICE) |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("State: MENU_VOICE, button short press")); |
|
|
|
|
#endif |
|
|
|
|
if (menu_voice == MENU_VOICE_BANK) |
|
|
|
|
menu_voice = MENU_VOICE_SOUND; |
|
|
|
|
else |
|
|
|
|
menu_voice = MENU_VOICE_BANK; |
|
|
|
|
UI_func_voice_selection(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/************************************************************************************
|
|
|
|
|
LEFT Encoder functions |
|
|
|
|
************************************************************************************/ |
|
|
|
|
void encoder_left_up(void) |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("Volume +")); |
|
|
|
|
#endif |
|
|
|
|
if (configuration.vol < 0.96) |
|
|
|
|
{ |
|
|
|
|
soften_volume.diff = 0.05 / SOFTEN_VALUE_CHANGE_STEPS; |
|
|
|
|
soften_volume.steps = SOFTEN_VALUE_CHANGE_STEPS; |
|
|
|
|
eeprom_write(); |
|
|
|
|
} |
|
|
|
|
UI_func_volume(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void encoder_left_down(void) |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("Volume -")); |
|
|
|
|
#endif |
|
|
|
|
if (configuration.vol > 0.04) |
|
|
|
|
{ |
|
|
|
|
soften_volume.diff = -0.05 / SOFTEN_VALUE_CHANGE_STEPS; |
|
|
|
|
soften_volume.steps = SOFTEN_VALUE_CHANGE_STEPS; |
|
|
|
|
eeprom_write(); |
|
|
|
|
} |
|
|
|
|
UI_func_volume(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void encoder_left_button_long(void) |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("Encoder left long press")); |
|
|
|
|
#else |
|
|
|
|
; |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void encoder_left_button_short(void) |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("Encoder left short press")); |
|
|
|
|
#endif |
|
|
|
|
if (menu_state == MENU_EDIT) |
|
|
|
|
{ |
|
|
|
|
menu_state = MENU_VOICE; |
|
|
|
|
UI_func_voice_selection(0); |
|
|
|
|
} |
|
|
|
|
else if (menu_state == MENU_VOICE) |
|
|
|
|
{ |
|
|
|
|
menu_state = MENU_EDIT; |
|
|
|
|
LCDML.MENU_goRoot(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|