Hi RonnieBlaze!
Wow, nice job!
I assume this is what you mean; replace the XY function for something easier and more flexible?
I'm not sure if the XY function (with huge array) is the most efficient way to do this - calculate XY instead of looking it up.
Just taking a stab at it, untested since I do not have a matrix of LEDs available at the moment.
I replaced some of the constants with defines as well (should be more memory efficient) - I hope I'm, not overlooking something here, since I do not fully understand why there was an array created. There could be a very good reason for that though, I'm just not seeing it (I may need more coffee since it's still early in the morning
).
// Params for width and height
#define kMatrixWidth = 54;
#define kMatrixHeight = 12;
#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
#define LAST_VISIBLE_LED NUM_LEDS-1
CRGB leds[ NUM_LEDS ];
uint16_t XY (uint16_t x, uint16_t y) {
if ( (x >= kMatrixWidth) || (y >= kMatrixHeight) ) {
return (LAST_VISIBLE_LED + 1);
}
return (y*kMatrixWidth)+x-1;
}
Since you're using FastLED, you can replace all showStrip() calls with FastLED.show() - this way you will not need the definition of the showStrip() function.
For this reason you can also get rid of the setPixel() function and replace calls like
setPixel(i,red,green,blue);
with
leds = CRGB( red,green,blue);
You can also remove the function setAll() since it's not being used (you're using the better fill_solid() function).
I also did some cleanup of the code, I personally prefer to see setup() and loop() first, and "helper" functions at the end.
I did remove some of the global variables (I try to use those as little as possible), and replaced some of the "while" loops with "for" loops.
You're referring to the "leds" array by address of the first LED (leds[0]), which should not be needed and can be done by just using "leds".
Apologies for taking the liberty to make a few changes - not trying to be a smart ass, it just helps me read the code. 
Of course, this code should be tested to see if everything still works as before - which I can't since I don't have a matrix available. The code does compile properly though.
Since the your previous code took way too much memory for my Arduino Uno, you may like the outcome of the modified code. It still takes up quite a bit of the dynamic memory (only 16 bytes left), but the previous code actually ran 1280 bytes short on memory (I suppose this is why you were asking?).
For comparison, the old code:
Sketch uses 4320 bytes (13%) of program storage space. Maximum is 32256 bytes.
Global variables use 3328 bytes (162%) of dynamic memory, leaving -1280 bytes for local variables. Maximum is 2048 bytes.
Not enough memory
and the new code:
Sketch uses 2894 bytes (8%) of program storage space. Maximum is 32256 bytes.
Global variables use 2032 bytes (99%) of dynamic memory, leaving 16 bytes for local variables. Maximum is 2048 bytes.
Low memory available, stability problems may occur.
All this results in:
// Modified V2 Mello Head
#include "FastLED.h"
// Params for width and height
#define kMatrixWidth 54
#define kMatrixHeight 12
// LED strip PIN
#define PIN 2
// Number of LEDs
#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
// FastLED LEDs array
CRGB leds[ NUM_LEDS ];
// Global variable for Hue (for functions that use this)
byte cycleHue = 0;
void setup()
{
FastLED.addLeds<WS2811, PIN, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
}
void loop() {
FastLED.setBrightness(50);
//myLights();
slantBars();
// AllRunningLights();
// FastLED.setBrightness(50);
// FlashLights();
}
void slantBars() {
static byte slantPos = 0;
for (byte x = 0; x < kMatrixWidth; x++) {
for (byte y = 0; y < kMatrixHeight; y++) {
leds[XY(x, y)] = CHSV(cycleHue, 255, quadwave8(x * 32 + y * 32 + slantPos));
}
}
slantPos -= 4;
}
void RunningLights(byte red, byte green, byte blue, int WaveDelay) {
int Position = 0;
int myCounter = 0;
for(int i=0; i<NUM_LEDS*3; i++)
{
if(myCounter<6) {
Position++; // = 0; //Position + Rate;
for(int i=0; i<NUM_LEDS; i++) {
// sine wave, 3 offset waves make a rainbow!
//float level = sin(i+Position) * 127 + 128;
leds = CRGB( 127, 127, 127);
float level = sin(i+Position) * 127 + 128;
leds = CRGB( ((sin(i+Position) * 127 + 128)/255)*red,
((sin(i+Position) * 127 + 128)/255)*green,
((sin(i+Position) * 127 + 128)/255)*blue );
}
FastLED.show();
myCounter++;
}
else {
return;
}
}
}
void AllRunningLights() {
for(int myCounter = 0; myCounter<5; myCounter++) {
RunningLights(0x00,0x80,0xff, 10);
RunningLights(0xEE,0x00,0xEE, 10);
RunningLights(0xff,0xff,0xff, 10);
RunningLights(0xff,0x70,0x00, 10);
RunningLights(0xff,0x10,0x10, 10);
RunningLights(0x26,0xff,0x00, 10);
}
return;
}
void myLights() {
fill_solid( leds, NUM_LEDS, CRGB( 0, 128, 255) ); //1
FastLED.show();
}
void FlashLights() {
for(int myCounter=0; myCounter<10; myCounter++) {
fill_solid( leds, NUM_LEDS, CRGB( 0, 128, 255) ); //1
FastLED.show();
delay(100);
fill_solid( leds, NUM_LEDS, CRGB( 0, 0, 0) );
FastLED.show();
delay(40);
fill_solid( leds, NUM_LEDS, CRGB( 238, 0, 238) ); //2
FastLED.show();
delay(100);
fill_solid( leds, NUM_LEDS, CRGB( 0, 0, 0) );
FastLED.show();
delay(40);
fill_solid( leds, NUM_LEDS, CRGB( 255, 255, 255) ); //3
FastLED.show();
delay(100);
fill_solid( leds, NUM_LEDS, CRGB( 0, 0, 0) );
FastLED.show();
delay(40);
fill_solid( leds, NUM_LEDS, CRGB( 255, 112, 0) ); //4
FastLED.show();
delay(100);
fill_solid( leds, NUM_LEDS, CRGB( 0, 0, 0) );
FastLED.show();
delay(40);
fill_solid( leds, NUM_LEDS, CRGB( 255, 16, 16) ); //5
FastLED.show();
delay(100);
fill_solid( leds, NUM_LEDS, CRGB( 0, 0, 0) );
FastLED.show();
delay(40);
fill_solid( leds, NUM_LEDS, CRGB( 38, 255, 0) ); //6
FastLED.show();
delay(100);
fill_solid( leds, NUM_LEDS, CRGB( 0, 0, 0) );
FastLED.show();
delay(40);
}
return;
}
// Convert X,Y to actual LED location
uint16_t XY (uint16_t x, uint16_t y) {
if ( (x >= kMatrixWidth) || (y >= kMatrixHeight) ) {
return (NUM_LEDS);
}
return (y*kMatrixWidth)+x-1;
}
// Increment the global hue value for functions that use it
void hueCycle(byte incr) {
cycleHue+=incr;
}
I've attached the INO file as well, and hope this is what you were looking for.
And I hope I didn't ruin the code
Let me know if it works as before (or not) and feel free to ask questions if you have any.