Small fixes for memory footprint.

dev
Holger Wirtz 2 years ago
parent dd97c55117
commit 7b21d94c77
  1. 4
      MicroDexed.ino
  2. 36
      UI.hpp
  3. 2
      dexed_sd.cpp

@ -916,7 +916,7 @@ bool checkMidiChannel(byte inChannel, uint8_t instance_id)
void init_MIDI_send_CC(void) void init_MIDI_send_CC(void)
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println("init_MIDI_send_CC():"); Serial.println(F("init_MIDI_send_CC():"));
#endif #endif
MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 7, configuration.dexed[selected_instance_id].sound_intensity); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 7, configuration.dexed[selected_instance_id].sound_intensity);
MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 10, configuration.dexed[selected_instance_id].pan); MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 10, configuration.dexed[selected_instance_id].pan);
@ -2991,7 +2991,7 @@ void show_patch(uint8_t instance_id)
Serial.println(F("+======+======+======+======+======+======+======+======+================+================+================+")); Serial.println(F("+======+======+======+======+======+======+======+======+================+================+================+"));
Serial.println(F("| R1 | R2 | R3 | R4 | L1 | L2 | L3 | L4 | LEV_SCL_BRK_PT | SCL_LEFT_DEPTH | SCL_RGHT_DEPTH |")); Serial.println(F("| R1 | R2 | R3 | R4 | L1 | L2 | L3 | L4 | LEV_SCL_BRK_PT | SCL_LEFT_DEPTH | SCL_RGHT_DEPTH |"));
Serial.println(F("+------+------+------+------+------+------+------+------+----------------+----------------+----------------+")); Serial.println(F("+------+------+------+------+------+------+------+------+----------------+----------------+----------------+"));
Serial.print("| "); Serial.print(F("| "));
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_EG_R1)); SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_EG_R1));
Serial.print(F(" | ")); Serial.print(F(" | "));
SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_EG_R2)); SerialPrintFormatInt3(MicroDexed[instance_id]->getVoiceDataElement((i * 21) + DEXED_OP_EG_R2));

@ -690,7 +690,7 @@ void lcdml_menu_control(void)
else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= LONG_BUTTON_PRESS) else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= LONG_BUTTON_PRESS)
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println("ENC-R long released"); Serial.println(F("ENC-R long released"));
#endif #endif
//LCDML.BT_quit(); //LCDML.BT_quit();
encoderDir[ENC_R].ButtonLong(true); encoderDir[ENC_R].ButtonLong(true);
@ -710,7 +710,7 @@ void lcdml_menu_control(void)
if (encoderDir[ENC_R].ButtonPressed() == true && (millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= LONG_BUTTON_PRESS) if (encoderDir[ENC_R].ButtonPressed() == true && (millis() - g_LCDML_CONTROL_button_press_time[ENC_R]) >= LONG_BUTTON_PRESS)
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println("ENC-R long recognized"); Serial.println(F("ENC-R long recognized"));
#endif #endif
encoderDir[ENC_R].ButtonLong(true); encoderDir[ENC_R].ButtonLong(true);
@ -6688,9 +6688,9 @@ uint8_t search_accepted_char(uint8_t c)
for (uint8_t i = 0; i < sizeof(accepted_chars) - 1; i++) for (uint8_t i = 0; i < sizeof(accepted_chars) - 1; i++)
{ {
Serial.print(i, DEC); Serial.print(i, DEC);
Serial.print(":"); Serial.print(F(":"));
Serial.print(c); Serial.print(c);
Serial.print("=="); Serial.print(F("=="));
Serial.println(accepted_chars[i], DEC); Serial.println(accepted_chars[i], DEC);
if (c == accepted_chars[i]) if (c == accepted_chars[i])
return (i); return (i);
@ -7287,14 +7287,14 @@ bool check_favorite(uint8_t b, uint8_t v, uint8_t instance_id)
{ {
snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d/%d.fav"), FAV_CONFIG_PATH, b, v); snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d/%d.fav"), FAV_CONFIG_PATH, b, v);
#ifdef DEBUG #ifdef DEBUG
Serial.print("check if Voice is a Favorite: "); Serial.print(F("check if Voice is a Favorite: "));
Serial.print(tmp); Serial.print(tmp);
Serial.println(); Serial.println();
#endif #endif
if (SD.exists(tmp)) if (SD.exists(tmp))
{ //is Favorite { //is Favorite
#ifdef DEBUG #ifdef DEBUG
Serial.println(" - It is in Favorites."); Serial.println(F(" - It is in Favorites."));
#endif #endif
return true; return true;
} }
@ -7302,7 +7302,7 @@ bool check_favorite(uint8_t b, uint8_t v, uint8_t instance_id)
{ // it was not a favorite { // it was not a favorite
#ifdef DEBUG #ifdef DEBUG
Serial.println(" - It is not in Favorites."); Serial.println(F(" - It is not in Favorites."));
#endif #endif
return false; return false;
} }
@ -7350,14 +7350,14 @@ bool quick_check_favorites_in_bank(uint8_t b, uint8_t instance_id)
{ {
snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d"), FAV_CONFIG_PATH, b); snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d"), FAV_CONFIG_PATH, b);
#ifdef DEBUG #ifdef DEBUG
Serial.print("check if there is a Favorite in Bank: "); Serial.print(F("check if there is a Favorite in Bank: "));
Serial.print(tmp); Serial.print(tmp);
Serial.println(); Serial.println();
#endif #endif
if (SD.exists(tmp) ) if (SD.exists(tmp) )
{ // this bank HAS at least 1 favorite(s) { // this bank HAS at least 1 favorite(s)
#ifdef DEBUG #ifdef DEBUG
Serial.println("quickcheck found a FAV in bank!"); Serial.println(F("quickcheck found a FAV in bank!"));
#endif #endif
return (true); return (true);
} }
@ -7365,7 +7365,7 @@ bool quick_check_favorites_in_bank(uint8_t b, uint8_t instance_id)
{ // no favorites in bank stored { // no favorites in bank stored
return (false); return (false);
#ifdef DEBUG #ifdef DEBUG
Serial.println(" - It is no Favorite in current Bank."); Serial.println(F(" - It is no Favorite in current Bank."));
#endif #endif
} }
} }
@ -7376,7 +7376,7 @@ bool quick_check_favorites_in_bank(uint8_t b, uint8_t instance_id)
void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id) void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id)
{ {
#ifdef DEBUG #ifdef DEBUG
Serial.println("Starting saving Favorite."); Serial.println(F("Starting saving Favorite."));
#endif #endif
b = constrain(b, 0, MAX_BANKS - 1); b = constrain(b, 0, MAX_BANKS - 1);
v = constrain(v, 0, MAX_VOICES - 1); v = constrain(v, 0, MAX_VOICES - 1);
@ -7389,7 +7389,7 @@ void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id)
snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d/%d.fav"), FAV_CONFIG_PATH, b, v); snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d/%d.fav"), FAV_CONFIG_PATH, b, v);
snprintf_P(tmpfolder, sizeof(tmpfolder), PSTR("/%s/%d"), FAV_CONFIG_PATH, b); snprintf_P(tmpfolder, sizeof(tmpfolder), PSTR("/%s/%d"), FAV_CONFIG_PATH, b);
#ifdef DEBUG #ifdef DEBUG
Serial.println("Save Favorite to SD card..."); Serial.println(F("Save Favorite to SD card..."));
Serial.println(tmp); Serial.println(tmp);
#endif #endif
if (!SD.exists(tmp)) if (!SD.exists(tmp))
@ -7400,7 +7400,7 @@ void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id)
} }
myFav = SD.open(tmp, FILE_WRITE); myFav = SD.open(tmp, FILE_WRITE);
myFav.close(); myFav.close();
Serial.println("Favorite saved..."); Serial.println(F("Favorite saved..."));
#ifdef TESTDISPLAY20x4 #ifdef TESTDISPLAY20x4
display.setCursor(17, 0); display.setCursor(17, 0);
#else #else
@ -7408,14 +7408,14 @@ void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id)
#endif #endif
display.write(2); //fav symbol display.write(2); //fav symbol
#ifdef DEBUG #ifdef DEBUG
Serial.println("Added to Favorites..."); Serial.println(F("Added to Favorites..."));
#endif #endif
} }
else else
{ // delete the file, is no longer a favorite { // delete the file, is no longer a favorite
SD.remove(tmp); SD.remove(tmp);
#ifdef DEBUG #ifdef DEBUG
Serial.println("Removed from Favorites..."); Serial.println(F("Removed from Favorites..."));
#endif #endif
for (i = 0; i < 32; i++) { //if no other favs exist in current bank, remove folder for (i = 0; i < 32; i++) { //if no other favs exist in current bank, remove folder
snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d/%d.fav"), FAV_CONFIG_PATH, b, i); snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d/%d.fav"), FAV_CONFIG_PATH, b, i);
@ -7425,9 +7425,9 @@ void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id)
snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d"), FAV_CONFIG_PATH, b); snprintf_P(tmp, sizeof(tmp), PSTR("/%s/%d"), FAV_CONFIG_PATH, b);
SD.rmdir(tmp); SD.rmdir(tmp);
#ifdef DEBUG #ifdef DEBUG
Serial.println("Fav count in bank:"); Serial.println(F("Fav count in bank:"));
Serial.print(countfavs); Serial.print(countfavs);
Serial.println("Removed folder since no voice in bank flagged as favorite any more"); Serial.println(F("Removed folder since no voice in bank flagged as favorite any more"));
#endif #endif
} }
#ifdef TESTDISPLAY20x4 #ifdef TESTDISPLAY20x4
@ -7437,7 +7437,7 @@ void save_favorite(uint8_t b, uint8_t v, uint8_t instance_id)
#endif #endif
display.print(" "); //remove fav symbol display.print(" "); //remove fav symbol
#ifdef DEBUG #ifdef DEBUG
Serial.println("Removed from Favorites..."); Serial.println(F("Removed from Favorites..."));
#endif #endif
} }
} }

@ -527,7 +527,7 @@ bool save_sd_drumsettings_json(uint8_t number)
AudioNoInterrupts(); AudioNoInterrupts();
if (SD.exists(filename)) { if (SD.exists(filename)) {
#ifdef DEBUG #ifdef DEBUG
Serial.println("remove old drumsettings file"); Serial.println(F("remove old drumsettings file"));
#endif #endif
SD.begin(); SD.begin();
SD.remove(filename); SD.remove(filename);

Loading…
Cancel
Save