I'm trying to compile my code but i keep exceeding my global variable memory by 12%. Is there anything i can do in my code to further reduce RAM usage? Or do i have to do modifications to the libraries I'm using? Here is my main program:
#include <MIDI.h>
#include <FastLED.h>
#include <SoftwareSerial.h>
#define LED_PIN 3
#define NUM_LEDS 60
#define LEDMAP 0xAB5AB5AB5AB5AB5
#define OFFSET 36
#define RANGECHECK if (pitch > 35 && pitch < 96)
SoftwareSerial softSerial(2, 4);
CRGB leds[NUM_LEDS];
MIDI_CREATE_INSTANCE(SoftwareSerial, softSerial, midiB);
void setup() {
FastLED.addLeds<WS2811, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.clear(true);
midiB.begin(MIDI_CHANNEL_OMNI);
midiB.setHandleNoteOn(HandleOn);
midiB.setHandleNoteOff(HandleOff);
}
void loop() {
midiB.read();
}
void HandleOn(byte channel, byte pitch, byte velocity)
{
RANGECHECK
{
leds[pitch - OFFSET] = bitRead(LEDMAP, (pitch - OFFSET)) ? CRGB::NavajoWhite : CRGB::Salmon;
FastLED.show();
}
}
void HandleOff(byte channel, byte pitch, byte velocity)
{
RANGECHECK
{
leds[pitch - OFFSET] = CRGB::Black;
FastLED.show();
}
}
I've reached my limit in optimizing my RAM usage here. Any suggestions for optimizing my code would be appreciated.