Fix for storing performance name.

dev
Holger Wirtz 2 years ago
parent 6993cdcb0b
commit 41340d18d9
  1. 1
      MicroDexed.ino
  2. 38
      UI.hpp
  3. 2
      UI_FX_T4.h
  4. 2
      addon/SD/PERFORMANCE/0/performance.json
  5. 1
      config.h
  6. 19
      dexed_sd.cpp

@ -2107,7 +2107,6 @@ void init_configuration(void) {
#endif
strlcpy(configuration.performance.name, "INIT Perf", sizeof(configuration.performance.name));
strlcpy(configuration.performance.name_temp, "INIT Perf", sizeof(configuration.performance.name_temp));
eeprom_update();
}

@ -4602,8 +4602,8 @@ void UI_func_save_performance(uint8_t param) {
overwrite = false;
if (check_sd_performance_exists(temp_int)) {
get_sd_performance_name_json(temp_int);
if (configuration.performance.name_temp[0] != 0)
display.show(1, 5, 11, configuration.performance.name_temp);
if (configuration.performance.name[0] != 0)
display.show(1, 5, 11, configuration.performance.name);
else
display.print("-- DATA -- ");
} else
@ -4660,8 +4660,8 @@ void UI_func_save_performance(uint8_t param) {
display.print("-- EMPTY --");
} else if (check_sd_performance_exists(temp_int)) {
get_sd_performance_name_json(temp_int);
if (configuration.performance.name_temp[0] != 0)
display.show(1, 5, 11, configuration.performance.name_temp);
if (configuration.performance.name[0] != 0)
display.show(1, 5, 11, configuration.performance.name);
else display.print("-- DATA -- ");
} else display.print("-- EMPTY --");
} else if (mode < 0xff) {
@ -4704,8 +4704,8 @@ void UI_func_load_performance(uint8_t param) {
display.print(tmp);
if (check_sd_performance_exists(temp_int)) {
get_sd_performance_name_json(temp_int);
if (configuration.performance.name_temp[0] != 0)
display.show(1, 5, 11, configuration.performance.name_temp);
if (configuration.performance.name[0] != 0)
display.show(1, 5, 11, configuration.performance.name);
else
display.print(" -- DATA -- ");
} else display.print(" -- EMPTY --");
@ -4737,8 +4737,8 @@ void UI_func_load_performance(uint8_t param) {
display.print(tmp);
if (check_sd_performance_exists(temp_int)) {
get_sd_performance_name_json(temp_int);
if (configuration.performance.name_temp[0] != 0)
display.show(1, 5, 11, configuration.performance.name_temp);
if (configuration.performance.name[0] != 0)
display.show(1, 5, 11, configuration.performance.name);
else
display.print(" -- DATA -- ");
} else display.print(" -- EMPTY --");
@ -5533,26 +5533,16 @@ void UI_func_set_performance_name(uint8_t param) {
{
if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) {
if (LCDML.BT_checkDown()) {
if (mode == 1) ui_select_name_state = UI_select_name(1, 1, configuration.performance.name_temp, BANK_NAME_LEN - 1, false);
if (mode == 1) ui_select_name_state = UI_select_name(1, 1, configuration.performance.name, PERFORMANCE_NAME_LEN - 1, false);
} else if (LCDML.BT_checkUp()) {
if (mode == 1) ui_select_name_state = UI_select_name(1, 1, configuration.performance.name_temp, BANK_NAME_LEN - 1, false);
// if (ui_select_name_state == false) {
// display.setCursor(12, 1);
// display.print(" ");
// display.setCursor(0, 1);
// display.print("[");
// display.setCursor(11, 1);
// display.print("]");
// display.blink();
// ui_select_name_state = UI_select_name(1, 1, configuration.performance.name_temp, BANK_NAME_LEN - 1, true);
// }
if (mode == 1) ui_select_name_state = UI_select_name(1, 1, configuration.performance.name, PERFORMANCE_NAME_LEN - 1, false);
}
} else if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) {
if (mode == 1) {
ui_select_name_state = UI_select_name(1, 1, configuration.performance.name_temp, BANK_NAME_LEN - 1, false);
ui_select_name_state = UI_select_name(1, 1, configuration.performance.name, PERFORMANCE_NAME_LEN - 1, false);
if (ui_select_name_state == true) {
strlcpy(configuration.performance.name, configuration.performance.name_temp, sizeof(configuration.performance.name));
strlcpy(configuration.performance.name, configuration.performance.name, sizeof(configuration.performance.name));
mode = 0xff;
display.noBlink();
display.setCursor(0, 1);
@ -5564,10 +5554,10 @@ void UI_func_set_performance_name(uint8_t param) {
}
if (mode == 0) {
mode = 1;
strlcpy(configuration.performance.name_temp, configuration.performance.name, sizeof(configuration.performance.name_temp));
strlcpy(configuration.performance.name, configuration.performance.name, sizeof(configuration.performance.name));
display.setCursor(0, 1);
display.print(F("[ ] "));
ui_select_name_state = UI_select_name(1, 1, configuration.performance.name_temp, BANK_NAME_LEN - 1, true);
ui_select_name_state = UI_select_name(1, 1, configuration.performance.name, PERFORMANCE_NAME_LEN - 1, true);
display.blink();
}
}

@ -141,7 +141,7 @@ LCDML_add(107, LCDML_0_4_2, 3, "220Hz", UI_func_eq_3);
LCDML_add(108, LCDML_0_4_2, 4, "1000Hz", UI_func_eq_4);
LCDML_add(109, LCDML_0_4_2, 5, "2000Hz", UI_func_eq_5);
LCDML_add(110, LCDML_0_4_2, 6, "7000Hz", UI_func_eq_6);
LCDML_add(111, LCDML_0_4_2, 7, "High-Cut", UI_func_eq_7)
LCDML_add(111, LCDML_0_4_2, 7, "High-Cut", UI_func_eq_7);
LCDML_add(112, LCDML_0, 5, "Load/Save", NULL);
LCDML_add(113, LCDML_0_5, 1, "Load Perf.", UI_func_load_performance);
LCDML_add(114, LCDML_0_5, 2, "Save Perf.", UI_func_save_performance);

@ -1,3 +1,3 @@
{
"name": "MD-Perf1"
"name": "Default"
}

@ -909,7 +909,6 @@ typedef struct sys_s {
typedef struct performance_s {
char name[PERFORMANCE_NAME_LEN];
char name_temp[PERFORMANCE_NAME_LEN];
} performance_t;
typedef struct drums_s {

@ -36,6 +36,10 @@
extern void set_drums_volume(float vol);
//extern drum_config_t drum_config[];
#endif
#include <LiquidCrystal_I2C.h>
#include "disp_plus.h"
extern Disp_Plus<LiquidCrystal_I2C> display;
extern void init_MIDI_send_CC(void);
extern void check_configuration_dexed(uint8_t instance_id);
@ -1143,6 +1147,7 @@ bool save_sd_performance_json(uint8_t number) {
AudioNoInterrupts();
display.show(1, 13, 3, "1/5");
check_performance_directory(number);
#ifdef DEBUG
@ -1150,7 +1155,9 @@ bool save_sd_performance_json(uint8_t number) {
Serial.println(number);
#endif
display.show(1, 13, 3, "2/5");
save_sd_fx_json(number);
display.show(1, 13, 3, "3/5");
save_sd_epiano_json(number);
for (uint8_t i = 0; i < MAX_DEXED; i++) {
@ -1159,6 +1166,7 @@ bool save_sd_performance_json(uint8_t number) {
Serial.print(F("Write Voice-Config"));
Serial.println(filename);
#endif
display.show(1, 13, 3, "4/5");
save_sd_voiceconfig_json(number, i);
}
@ -1173,10 +1181,11 @@ bool save_sd_performance_json(uint8_t number) {
Serial.println(filename);
#endif
display.show(1, 13, 3, "5/5");
SD.remove(filename);
json = SD.open(filename, FILE_WRITE);
if (json) {
strlcpy(data_json["name"] | "NoName", configuration.performance.name_temp, sizeof(configuration.performance.name_temp));
data_json["name"] = configuration.performance.name;
serializeJsonPretty(data_json, json);
json.close();
AudioInterrupts();
@ -1254,12 +1263,13 @@ void get_sd_performance_name_json(uint8_t number) {
AudioInterrupts();
}
strlcpy(configuration.performance.name_temp, data_json["name"] | "NoName", sizeof(configuration.performance.name_temp));
strlcpy(configuration.performance.name, data_json["name"] | "NoName", sizeof(configuration.performance.name));
#ifdef DEBUG
Serial.print(F("Get performance name for "));
Serial.print(number);
Serial.print(F(": ["));
Serial.print(configuration.performance.name_temp);
Serial.print(configuration.performance.name);
Serial.println("]");
#endif
}
@ -1267,6 +1277,9 @@ void get_sd_performance_name_json(uint8_t number) {
}
bool load_sd_performance_json(uint8_t number) {
get_sd_performance_name_json(number);
dac_mute();
handleStop();
number = constrain(number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX);

Loading…
Cancel
Save