|
|
@ -73,7 +73,7 @@ extern void eeprom_update(void); |
|
|
|
#if NUM_DRUMS > 0 |
|
|
|
#if NUM_DRUMS > 0 |
|
|
|
#include "midinotes.h" |
|
|
|
#include "midinotes.h" |
|
|
|
#include "drumset.h" |
|
|
|
#include "drumset.h" |
|
|
|
extern void get_sd_performance_name_json(uint8_t number); |
|
|
|
extern void get_sd_performance_name_json(uint8_t number,char* name, uint8_t len); |
|
|
|
extern bool save_sd_performance_json(uint8_t p); |
|
|
|
extern bool save_sd_performance_json(uint8_t p); |
|
|
|
extern uint8_t drum_midi_channel; |
|
|
|
extern uint8_t drum_midi_channel; |
|
|
|
//extern drum_config_t drum_config[NUM_DRUMSET_CONFIG];
|
|
|
|
//extern drum_config_t drum_config[NUM_DRUMSET_CONFIG];
|
|
|
@ -4601,9 +4601,10 @@ void UI_func_save_performance(uint8_t param) { |
|
|
|
else |
|
|
|
else |
|
|
|
overwrite = false; |
|
|
|
overwrite = false; |
|
|
|
if (check_sd_performance_exists(temp_int)) { |
|
|
|
if (check_sd_performance_exists(temp_int)) { |
|
|
|
get_sd_performance_name_json(temp_int); |
|
|
|
char tmp_confname[PERFORMANCE_NAME_LEN]; |
|
|
|
if (configuration.performance.name[0] != 0) |
|
|
|
get_sd_performance_name_json(temp_int, tmp_confname, sizeof(tmp_confname)); |
|
|
|
display.show(1, 5, 11, configuration.performance.name); |
|
|
|
if (tmp_confname[0] != 0) |
|
|
|
|
|
|
|
display.show(1, 5, 11, tmp_confname); |
|
|
|
else |
|
|
|
else |
|
|
|
display.print("-- DATA -- "); |
|
|
|
display.print("-- DATA -- "); |
|
|
|
} else |
|
|
|
} else |
|
|
@ -4659,11 +4660,14 @@ void UI_func_save_performance(uint8_t param) { |
|
|
|
if (overwrite == false) { |
|
|
|
if (overwrite == false) { |
|
|
|
display.print("-- EMPTY --"); |
|
|
|
display.print("-- EMPTY --"); |
|
|
|
} else if (check_sd_performance_exists(temp_int)) { |
|
|
|
} else if (check_sd_performance_exists(temp_int)) { |
|
|
|
get_sd_performance_name_json(temp_int); |
|
|
|
char tmp_confname[PERFORMANCE_NAME_LEN]; |
|
|
|
if (configuration.performance.name[0] != 0) |
|
|
|
get_sd_performance_name_json(temp_int, tmp_confname, sizeof(tmp_confname)); |
|
|
|
display.show(1, 5, 11, configuration.performance.name); |
|
|
|
if (tmp_confname[0] != 0) |
|
|
|
else display.print("-- DATA -- "); |
|
|
|
display.show(1, 5, 11, tmp_confname); |
|
|
|
} else display.print("-- EMPTY --"); |
|
|
|
else |
|
|
|
|
|
|
|
display.print("-- DATA -- "); |
|
|
|
|
|
|
|
} else |
|
|
|
|
|
|
|
display.print("-- EMPTY --"); |
|
|
|
} else if (mode < 0xff) { |
|
|
|
} else if (mode < 0xff) { |
|
|
|
display.setCursor(12, 1); |
|
|
|
display.setCursor(12, 1); |
|
|
|
if (yesno == true) { |
|
|
|
if (yesno == true) { |
|
|
@ -4672,7 +4676,6 @@ void UI_func_save_performance(uint8_t param) { |
|
|
|
display.print(F("NO ")); |
|
|
|
display.print(F("NO ")); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//encoderDir[ENC_R].reset();
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_close()) // ****** STABLE END *********
|
|
|
|
if (LCDML.FUNC_close()) // ****** STABLE END *********
|
|
|
@ -4703,7 +4706,7 @@ void UI_func_load_performance(uint8_t param) { |
|
|
|
snprintf_P(tmp, sizeof(tmp), PSTR("[%2d]"), temp_int); |
|
|
|
snprintf_P(tmp, sizeof(tmp), PSTR("[%2d]"), temp_int); |
|
|
|
display.print(tmp); |
|
|
|
display.print(tmp); |
|
|
|
if (check_sd_performance_exists(temp_int)) { |
|
|
|
if (check_sd_performance_exists(temp_int)) { |
|
|
|
get_sd_performance_name_json(temp_int); |
|
|
|
get_sd_performance_name_json(temp_int, configuration.performance.name, sizeof(configuration.performance.name)); |
|
|
|
if (configuration.performance.name[0] != 0) |
|
|
|
if (configuration.performance.name[0] != 0) |
|
|
|
display.show(1, 5, 11, configuration.performance.name); |
|
|
|
display.show(1, 5, 11, configuration.performance.name); |
|
|
|
else |
|
|
|
else |
|
|
@ -4736,7 +4739,7 @@ void UI_func_load_performance(uint8_t param) { |
|
|
|
snprintf_P(tmp, sizeof(tmp), PSTR("[%2d]"), temp_int); |
|
|
|
snprintf_P(tmp, sizeof(tmp), PSTR("[%2d]"), temp_int); |
|
|
|
display.print(tmp); |
|
|
|
display.print(tmp); |
|
|
|
if (check_sd_performance_exists(temp_int)) { |
|
|
|
if (check_sd_performance_exists(temp_int)) { |
|
|
|
get_sd_performance_name_json(temp_int); |
|
|
|
get_sd_performance_name_json(temp_int, configuration.performance.name, sizeof(configuration.performance.name)); |
|
|
|
if (configuration.performance.name[0] != 0) |
|
|
|
if (configuration.performance.name[0] != 0) |
|
|
|
display.show(1, 5, 11, configuration.performance.name); |
|
|
|
display.show(1, 5, 11, configuration.performance.name); |
|
|
|
else |
|
|
|
else |
|
|
@ -5528,21 +5531,31 @@ void UI_func_set_performance_name(uint8_t param) { |
|
|
|
mode = 0; |
|
|
|
mode = 0; |
|
|
|
display.setCursor(0, 0); |
|
|
|
display.setCursor(0, 0); |
|
|
|
display.print(F("Perf. Name")); |
|
|
|
display.print(F("Perf. Name")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool found = false; |
|
|
|
|
|
|
|
for (uint8_t i = 0; i < sizeof(configuration.performance.name) - 1; i++) { |
|
|
|
|
|
|
|
if (configuration.performance.name[i] == 0 && found == false) |
|
|
|
|
|
|
|
found = true; |
|
|
|
|
|
|
|
if (found == true) { |
|
|
|
|
|
|
|
configuration.performance.name[i] = ' '; |
|
|
|
|
|
|
|
configuration.performance.name[i + 1] = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_loop()) // ****** LOOP *********
|
|
|
|
if (LCDML.FUNC_loop()) // ****** LOOP *********
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { |
|
|
|
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { |
|
|
|
if (LCDML.BT_checkDown()) { |
|
|
|
if (LCDML.BT_checkDown()) { |
|
|
|
if (mode == 1) ui_select_name_state = UI_select_name(1, 1, configuration.performance.name, PERFORMANCE_NAME_LEN - 1, false); |
|
|
|
if (mode == 1) ui_select_name_state = UI_select_name(1, 1, configuration.performance.name, sizeof(configuration.performance.name), false); |
|
|
|
} else if (LCDML.BT_checkUp()) { |
|
|
|
} else if (LCDML.BT_checkUp()) { |
|
|
|
if (mode == 1) ui_select_name_state = UI_select_name(1, 1, configuration.performance.name, PERFORMANCE_NAME_LEN - 1, false); |
|
|
|
if (mode == 1) ui_select_name_state = UI_select_name(1, 1, configuration.performance.name, sizeof(configuration.performance.name), false); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) { |
|
|
|
} else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) { |
|
|
|
|
|
|
|
|
|
|
|
if (mode == 1) { |
|
|
|
if (mode == 1) { |
|
|
|
ui_select_name_state = UI_select_name(1, 1, configuration.performance.name, PERFORMANCE_NAME_LEN - 1, false); |
|
|
|
ui_select_name_state = UI_select_name(1, 1, configuration.performance.name, sizeof(configuration.performance.name), false); |
|
|
|
if (ui_select_name_state == true) { |
|
|
|
if (ui_select_name_state == true) { |
|
|
|
strlcpy(configuration.performance.name, configuration.performance.name, sizeof(configuration.performance.name)); |
|
|
|
|
|
|
|
mode = 0xff; |
|
|
|
mode = 0xff; |
|
|
|
display.noBlink(); |
|
|
|
display.noBlink(); |
|
|
|
display.setCursor(0, 1); |
|
|
|
display.setCursor(0, 1); |
|
|
@ -5554,10 +5567,9 @@ void UI_func_set_performance_name(uint8_t param) { |
|
|
|
} |
|
|
|
} |
|
|
|
if (mode == 0) { |
|
|
|
if (mode == 0) { |
|
|
|
mode = 1; |
|
|
|
mode = 1; |
|
|
|
strlcpy(configuration.performance.name, configuration.performance.name, sizeof(configuration.performance.name)); |
|
|
|
|
|
|
|
display.setCursor(0, 1); |
|
|
|
display.setCursor(0, 1); |
|
|
|
display.print(F("[ ] ")); |
|
|
|
display.print(F("[ ] ")); |
|
|
|
ui_select_name_state = UI_select_name(1, 1, configuration.performance.name, PERFORMANCE_NAME_LEN - 1, true); |
|
|
|
ui_select_name_state = UI_select_name(1, 1, configuration.performance.name, sizeof(configuration.performance.name), true); |
|
|
|
display.blink(); |
|
|
|
display.blink(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -6205,15 +6217,11 @@ bool UI_select_name(uint8_t y, uint8_t x, char* edit_string, uint8_t len, bool i |
|
|
|
static int8_t edit_pos; |
|
|
|
static int8_t edit_pos; |
|
|
|
static bool edit_mode; |
|
|
|
static bool edit_mode; |
|
|
|
static uint8_t edit_value; |
|
|
|
static uint8_t edit_value; |
|
|
|
static uint8_t last_char_pos; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (init == true) { |
|
|
|
if (init == true) { |
|
|
|
edit_mode = false; |
|
|
|
edit_mode = false; |
|
|
|
edit_pos = 0; |
|
|
|
edit_pos = 0; |
|
|
|
edit_value = search_accepted_char(edit_string[edit_pos]); |
|
|
|
edit_value = search_accepted_char(edit_string[edit_pos]); |
|
|
|
last_char_pos = strlen(edit_string); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string_trim(edit_string); // just to be sure
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
display.setCursor(x, y); |
|
|
|
display.setCursor(x, y); |
|
|
|
display.print(edit_string); |
|
|
|
display.print(edit_string); |
|
|
@ -6222,88 +6230,69 @@ bool UI_select_name(uint8_t y, uint8_t x, char* edit_string, uint8_t len, bool i |
|
|
|
return (false); |
|
|
|
return (false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (LCDML.BT_checkDown() || LCDML.BT_checkUp()) { |
|
|
|
if (LCDML.BT_checkDown() || LCDML.BT_checkUp() || LCDML.BT_checkEnter()) { |
|
|
|
if (LCDML.BT_checkDown()) { |
|
|
|
switch (edit_mode) { |
|
|
|
if (edit_mode == true) { |
|
|
|
case true: |
|
|
|
edit_value = search_accepted_char(edit_string[edit_pos]); |
|
|
|
edit_value = search_accepted_char(edit_string[edit_pos]); |
|
|
|
|
|
|
|
if (LCDML.BT_checkDown()) { |
|
|
|
if (edit_value < sizeof(accepted_chars) - 2) |
|
|
|
if (edit_value < sizeof(accepted_chars) - 2) |
|
|
|
edit_value++; |
|
|
|
edit_value++; |
|
|
|
if (edit_value == 0 && edit_string[constrain(edit_pos + 1, 0, len)] > 0) |
|
|
|
} else if (LCDML.BT_checkUp()) { |
|
|
|
edit_value = 1; |
|
|
|
if (edit_value > 0) |
|
|
|
|
|
|
|
edit_value--; |
|
|
|
|
|
|
|
} else if (LCDML.BT_checkEnter()) { |
|
|
|
|
|
|
|
edit_mode = !edit_mode; |
|
|
|
|
|
|
|
display.setCursor(LCD_cols - 1, 0); |
|
|
|
|
|
|
|
display.print(F(" ")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
edit_string[edit_pos] = accepted_chars[edit_value]; |
|
|
|
edit_string[edit_pos] = accepted_chars[edit_value]; |
|
|
|
|
|
|
|
|
|
|
|
display.setCursor(x + edit_pos, y); |
|
|
|
display.setCursor(x + edit_pos, y); |
|
|
|
display.print(edit_string[edit_pos]); |
|
|
|
display.print(edit_string[edit_pos]); |
|
|
|
} else { |
|
|
|
|
|
|
|
if (edit_string[edit_pos] != 0 && edit_string[edit_pos] != 32) |
|
|
|
break; |
|
|
|
edit_pos = constrain(edit_pos + 1, 0, len); |
|
|
|
case false: |
|
|
|
else { |
|
|
|
if (LCDML.BT_checkDown()) { |
|
|
|
if (edit_pos + 1 > last_char_pos) |
|
|
|
if (edit_pos < len - 1) |
|
|
|
edit_pos = len; |
|
|
|
edit_pos++; |
|
|
|
|
|
|
|
} else if (LCDML.BT_checkUp()) { |
|
|
|
|
|
|
|
if (edit_pos > 0) |
|
|
|
|
|
|
|
edit_pos--; |
|
|
|
|
|
|
|
} else if (LCDML.BT_checkEnter()) { |
|
|
|
|
|
|
|
if (edit_pos == len - 1) { // OK pressed
|
|
|
|
|
|
|
|
edit_pos = 0; |
|
|
|
|
|
|
|
edit_mode = false; |
|
|
|
|
|
|
|
string_trim(edit_string); |
|
|
|
|
|
|
|
return (true); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
edit_mode = !edit_mode; |
|
|
|
|
|
|
|
display.setCursor(LCD_cols - 1, 0); |
|
|
|
|
|
|
|
display.print(F("*")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (edit_pos == len) { |
|
|
|
if (edit_pos > len - 2) { |
|
|
|
display.noBlink(); |
|
|
|
display.noBlink(); |
|
|
|
display.setCursor(x - 1, y); |
|
|
|
display.setCursor(x - 1, y); |
|
|
|
display.print(F(" ")); |
|
|
|
display.print(F(" ")); |
|
|
|
display.setCursor(x + len, y); |
|
|
|
display.setCursor(x + len - 1, y); |
|
|
|
display.print(F(" ")); |
|
|
|
display.print(F(" ")); |
|
|
|
display.setCursor(x + len + 1, y); |
|
|
|
display.setCursor(LCD_cols - 4, y); |
|
|
|
display.print(F("[OK]")); |
|
|
|
display.print(F("[OK]")); |
|
|
|
} |
|
|
|
} else if (edit_pos == len - 2) { |
|
|
|
} |
|
|
|
|
|
|
|
} else if (LCDML.BT_checkUp()) { |
|
|
|
|
|
|
|
if (edit_mode == true) { |
|
|
|
|
|
|
|
edit_value = search_accepted_char(edit_string[edit_pos]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (edit_value >= 1) |
|
|
|
|
|
|
|
edit_value--; |
|
|
|
|
|
|
|
if (edit_value == 0 && edit_string[constrain(edit_pos + 1, 0, len)] > 0) |
|
|
|
|
|
|
|
edit_value = 1; |
|
|
|
|
|
|
|
edit_string[edit_pos] = accepted_chars[edit_value]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
display.setCursor(x + edit_pos, y); |
|
|
|
|
|
|
|
display.print(edit_string[edit_pos]); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (edit_pos - 1 > last_char_pos) |
|
|
|
|
|
|
|
edit_pos = last_char_pos; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
edit_pos = constrain(edit_pos - 1, 0, len - 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (edit_pos == last_char_pos) { |
|
|
|
|
|
|
|
display.setCursor(x - 1, y); |
|
|
|
display.setCursor(x - 1, y); |
|
|
|
display.print(F("[")); |
|
|
|
display.print(F("[")); |
|
|
|
display.setCursor(x + len, y); |
|
|
|
display.setCursor(x + len - 1, y); |
|
|
|
display.print(F("]")); |
|
|
|
display.print(F("]")); |
|
|
|
display.setCursor(x + len + 1, y); |
|
|
|
display.setCursor(LCD_cols - 4, y); |
|
|
|
display.print(F(" ")); |
|
|
|
display.print(F(" ")); |
|
|
|
display.blink(); |
|
|
|
display.blink(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (LCDML.BT_checkEnter()) { |
|
|
|
|
|
|
|
last_char_pos = strlen(edit_string); |
|
|
|
|
|
|
|
if (edit_pos >= len) { |
|
|
|
|
|
|
|
edit_pos = 0; |
|
|
|
|
|
|
|
edit_mode = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (true); |
|
|
|
break; |
|
|
|
} else { |
|
|
|
|
|
|
|
last_char_pos = strlen(edit_string); |
|
|
|
|
|
|
|
edit_mode = !edit_mode; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (edit_mode == false && edit_pos < len && edit_string[edit_pos] != 0 && edit_string[edit_pos] != 32) |
|
|
|
|
|
|
|
edit_pos++; |
|
|
|
|
|
|
|
if (edit_mode == true) { |
|
|
|
|
|
|
|
display.setCursor(x + len + 1, y); |
|
|
|
|
|
|
|
display.print(F("*")); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
display.setCursor(x + len + 1, y); |
|
|
|
|
|
|
|
display.print(F(" ")); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
display.setCursor(x + edit_pos, y); |
|
|
|
display.setCursor(x + edit_pos, y); |
|
|
|
encoderDir[ENC_R].reset(); |
|
|
|
encoderDir[ENC_R].reset(); |
|
|
|
|
|
|
|
|
|
|
|