|
|
@ -4850,14 +4850,21 @@ void UI_func_sysex_receive_bank(uint8_t param) |
|
|
|
|
|
|
|
|
|
|
|
void UI_func_sysex_send_bank(uint8_t param) |
|
|
|
void UI_func_sysex_send_bank(uint8_t param) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
char bank_name[BANK_NAME_LEN]; |
|
|
|
|
|
|
|
static uint8_t bank_number; |
|
|
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_setup()) // ****** SETUP *********
|
|
|
|
if (LCDML.FUNC_setup()) // ****** SETUP *********
|
|
|
|
{ |
|
|
|
{ |
|
|
|
encoderDir[ENC_R].reset(); |
|
|
|
encoderDir[ENC_R].reset(); |
|
|
|
|
|
|
|
bank_number = configuration.performance.bank[selected_instance_id]; |
|
|
|
lcd.setCursor(0, 0); |
|
|
|
lcd.setCursor(0, 0); |
|
|
|
lcd.print(F("MIDI Send Bank")); |
|
|
|
lcd.print(F("MIDI Send Bank")); |
|
|
|
lcd.setCursor(0, 1); |
|
|
|
if (!get_bank_name(configuration.performance.bank[selected_instance_id], bank_name, sizeof(bank_name))) |
|
|
|
lcd.print(F("Not implemented.")); |
|
|
|
strncpy(bank_name, "*ERROR*", sizeof(bank_name)); |
|
|
|
|
|
|
|
lcd.show(1, 0, 1, "["); |
|
|
|
|
|
|
|
lcd.show(1, 3, 1, "]"); |
|
|
|
|
|
|
|
lcd.show(1, 1, 2, configuration.performance.bank[selected_instance_id]); |
|
|
|
|
|
|
|
lcd.show(1, 5, 10, bank_name); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_loop()) // ****** LOOP *********
|
|
|
|
if (LCDML.FUNC_loop()) // ****** LOOP *********
|
|
|
@ -4866,18 +4873,74 @@ void UI_func_sysex_send_bank(uint8_t param) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (LCDML.BT_checkDown()) |
|
|
|
if (LCDML.BT_checkDown()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
; |
|
|
|
bank_number = constrain(bank_number + ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
else if (LCDML.BT_checkUp()) |
|
|
|
else if (LCDML.BT_checkUp()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
; |
|
|
|
bank_number = constrain(bank_number - ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!get_bank_name(bank_number, bank_name, sizeof(bank_name))) |
|
|
|
|
|
|
|
strcpy(bank_name, "*ERROR*"); |
|
|
|
|
|
|
|
lcd.show(1, 1, 2, bank_number); |
|
|
|
|
|
|
|
lcd.show(1, 5, 10, bank_name); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
File sysex; |
|
|
|
|
|
|
|
char filename[FILENAME_LEN]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (get_bank_name(bank_number, bank_name, sizeof(bank_name))) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
sprintf(filename, "/%d/%s.syx", bank_number, bank_name); |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.print(F("Send bank ")); |
|
|
|
|
|
|
|
Serial.print(filename); |
|
|
|
|
|
|
|
Serial.println(F(" from SD.")); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
sysex = SD.open(filename); |
|
|
|
|
|
|
|
if (!sysex) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
|
|
Serial.println(F("Connot read from SD.")); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
lcd.show(1, 0, 16, "Read error."); |
|
|
|
|
|
|
|
bank_number = 0xff; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
uint8_t bank_data[4104]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sysex.read(bank_data, 4104); |
|
|
|
|
|
|
|
sysex.close(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lcd.show(1, 0, 16, "Sending..."); |
|
|
|
|
|
|
|
send_sysex_bank(configuration.dexed[selected_instance_id].midi_channel, bank_data); |
|
|
|
|
|
|
|
lcd.show(1, 0, 16, "Done."); |
|
|
|
|
|
|
|
bank_number = 0xff; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
lcd.show(1, 0, 16, "No bank."); |
|
|
|
|
|
|
|
bank_number = 0xff; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delay(MESSAGE_WAIT_TIME); |
|
|
|
|
|
|
|
LCDML.FUNC_goBackToMenu(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (LCDML.FUNC_close()) // ****** STABLE END *********
|
|
|
|
if (LCDML.FUNC_close()) // ****** STABLE END *********
|
|
|
|
{ |
|
|
|
{ |
|
|
|
encoderDir[ENC_R].reset(); |
|
|
|
encoderDir[ENC_R].reset(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bank_number != 0xff) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
lcd.setCursor(0, 1); |
|
|
|
|
|
|
|
lcd.print(F("Canceled. ")); |
|
|
|
|
|
|
|
delay(MESSAGE_WAIT_TIME); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|