From fdf072be0d4e96a1226a2dadc5c013de86ada677 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Mon, 12 Sep 2022 10:55:17 +0200 Subject: [PATCH] Optimizatioins for memory footprint. --- MicroDexed.ino | 8 ++++---- UI.hpp | 4 ++-- midi_devices.hpp | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 00f153d..0a80b29 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -280,7 +280,7 @@ AudioConnection* dynamicConnections[NUM_DEXED * 15 + NUM_DRUMS * 4]; #else AudioConnection* dynamicConnections[NUM_DEXED * 4 + NUM_DRUMS * 2]; #endif -void create_audio_dexed_chain(uint8_t instance_id) +FLASHMEM void create_audio_dexed_chain(uint8_t instance_id) { MicroDexed[instance_id] = new AudioSynthDexed(MAX_NOTES / NUM_DEXED, SAMPLE_RATE); mono2stereo[instance_id] = new AudioEffectMonoStereo(); @@ -331,7 +331,7 @@ void create_audio_dexed_chain(uint8_t instance_id) // Dynamic patching of Drum objects // #if NUM_DRUMS > 0 -void create_audio_drum_chain(uint8_t instance_id) +FLASHMEM void create_audio_drum_chain(uint8_t instance_id) { //Drum[instance_id] = new AudioPlayMemory(); Drum[instance_id] = new AudioPlayArrayResmp(); @@ -2585,7 +2585,7 @@ void generate_version_string(char* buffer, uint8_t len) #endif } -uint8_t check_sd_cards(void) +FLASHMEM uint8_t check_sd_cards(void) { uint8_t ret = 0; @@ -2689,7 +2689,7 @@ uint8_t check_sd_cards(void) return (ret); } -void check_and_create_directories(void) +FLASHMEM void check_and_create_directories(void) { if (sd_card > 0) { diff --git a/UI.hpp b/UI.hpp index 50c4784..6121fc7 100644 --- a/UI.hpp +++ b/UI.hpp @@ -540,7 +540,7 @@ uint8_t * rotTile(const uint8_t * tile) } #endif -void setup_ui(void) +FLASHMEM void setup_ui(void) { // LCD Begin #ifdef I2C_DISPLAY @@ -564,7 +564,7 @@ void setup_ui(void) } #ifdef DEBUG -void setup_debug_message(void) +FLASHMEM void setup_debug_message(void) { // LCD Begin display.clear(); diff --git a/midi_devices.hpp b/midi_devices.hpp index 90544d0..6dca28e 100644 --- a/midi_devices.hpp +++ b/midi_devices.hpp @@ -108,7 +108,7 @@ void handle_generic(byte inChannel, byte inData1, byte inData2, const char *midi break; } #ifdef DEBUG - Serial.printf("[%s] %s", midi_device, text); + Serial.printf_P(PSTR("[%s] %s"), midi_device, text); #endif // MIDI THRU @@ -222,7 +222,7 @@ void handle_generic(byte inChannel, byte inData1, byte inData2, const char *midi void handleSystemExclusive_generic(byte *data, uint len, const char *midi_device) { handleSystemExclusive(data, len); #ifdef DEBUG - Serial.printf("[%s] SysEx", midi_device); + Serial.printf_P(PSTR("[%s] SysEx"), midi_device); #endif // MIDI THRU @@ -282,7 +282,7 @@ void handleSystemCommon_generic(byte inData1, const char *midi_device, midi::Mid break; } #ifdef DEBUG - Serial.printf("[%s] %s", midi_device, text); + Serial.printf_P(PSTR("[%s] %s"), midi_device, text); #endif // MIDI THRU @@ -390,7 +390,7 @@ void handleRealtime_generic(const char *midi_device, midi::MidiType event) break; } #ifdef DEBUG - Serial.printf("[%s] %s", midi_device, text); + Serial.printf_P(PSTR("[%s] %s"), midi_device, text); #endif // MIDI THRU