r/FastLED • u/4wheeljive Jeff Holman • May 27 '25
Support Using ScreenMap with non-standard LED layouts?
I'd love some help figuring out how to include fl::ScreenMap functionality in sketches for displays that involve something other than a super-basic LED layout.
tl/dr:
- How can I incorporate an existing lookup table?
- How can I implement ScreenMap with multiple data pins?
The LED panel I'm currently working with is 32x48, with six 32x8 tiles driven in pairs by 3 data pins. For each pair, the second tile is rotated 180 degrees relative to the first, like this:
[EDIT: I realized the picture below is for my 64x48 panel. My 32x48 panel has only one row of tiles.]

I've created a handful of 1D and 2D arrays that map XY coordinates to LED index number (and vice versa), which I use as lookup tables in my sketches.
I know that ScreenMap allows for the use of a lookup table, which is shown in the Fire2023 example, but I haven't figured out how to adapt that to my situation. https://github.com/FastLED/FastLED/blob/master/examples/Fire2023/Fire2023.ino
In Fire2023, it seems like the makeScreenMap() function (beginning at line 118) is *creating* a lookup table that (I assume) matches the XYTable set forth at the bottom of the sketch, but it doesn't seem that ScreenMap actually uses that XYTable in any way. Is that correct?
If so, is there a way to reference an existing lut? It seems like this would be necessary for the ScreenMap lut functionality to work with any physical LED arrangement that can't be easily mapped with a basic function like it is in Fire2023.
Here's a sketch for my 32x48 panel (stripped down for this help request) that runs two different kinds of patterns: one based on Pride (fundamentally, a 1D pattern), and one based on rainbowMatrix (a 2D pattern): https://gist.github.com/4wheeljive/30742e20c2bbed4a3784ac69ee707978
At the bottom of the sketch are two arrays with 1D and 2D mappings of my layout that correspond to the respective logic of the two pattern functions.
At various spots near the top of the sketch, I've included as comments some code that I think might, in some modified form, be used to implement the ScreenMap functionality. I would greatly appreciate any suggestions anyone might have on how to actually make this work.
Thanks!!!
View all comments
Show parent comment
1
u/4wheeljive Jeff Holman Jun 11 '25
YES!!! I think that was it. After reading that warning and posting this, I tried something in my sketch. I put my custom (non-rectangular?) map through WaveFX, and I used the "rectangular" XYMap for the blend, and it worked for my LED panel (although not the the web display):
XYMap myXYmap = XYMap::constructWithUserFunction(WIDTH, HEIGHT, myXYFunctionLED);XYMap xyRect = XYMap::constructRectangularGrid(WIDTH, HEIGHT);...WaveFx waveFxLower(myXYmap, CreateArgsLower()); // Lower/background wave layer (blue)WaveFx waveFxUpper(myXYmap, CreateArgsUpper()); // Upper/foreground wave layer (green/red)Blend2d fxBlend(xyRect);This is the exact opposite of what the comments and structure in the example seemed to me to suggest (and which is the approach I needed to use to display properly on the screen):
// Create mappings between 1D array positions and 2D x,y coordinatesXYMap xyMap(WIDTH, HEIGHT, IS_SERPINTINE); // For the actual LED output (may be serpentine)XYMap xyRect(WIDTH, HEIGHT, false); // For the wave simulation (always rectangular grid)...// Create the two wave simulation layers with their default configurationsWaveFx waveFxLower(xyRect, CreateArgsLower()); // Lower/background wave layer (blue)WaveFx waveFxUpper(xyRect, CreateArgsUpper()); // Upper/foreground wave layer (green/red)// Create a blender that will combine the two wave layersBlend2d fxBlend(xyMap);So my tentative takeaway is:
Is this possibly a correct conclusion?