Just starting with the SmartMatrix System. The example FastLed_Panel_Plus_APA102.ino works with one APA102 8x8 panel. I have a 32x32 LED setup with a 4x4 of 8x8 panels in series for a total of 1024 LEDs. There are a number of 8x8 panels out there using descrete LEDs, so this arrangement works well.
I think I read that the LED layout mapping is loaded into the SmartMatrix. I don’t see any obvious code where I can modify the physical LED layout. What’s the process to do this and in what section of code? I want to avoid including the GXF layer if possible.
I’m using the new V5 w/ Teensy4.1 and lattest SmartMatrix (no number) library.
Hi Paul, unfortunately the APA102 support in SmartMatrix Library is pretty new and only has support for a single matrix in serpentine pattern.
I don’t think it’s going to be possible to reuse the MultiRowRefreshMapping code I have for HUB75 panels as the way you typically tile APA102 matrices is different.
@marcmerlin’s SmartMatrix::GFX Library might work for this as it allows you to use LEDMatrix (take a look at the README which quickly shows what the library does) which allows for tiling smaller panels to make a larger panel. I haven’t tried this combination myself.
If you don’t want to include the GFX Layers in SmartMatrix Library for whatever reason, then including several additional libraries probably isn’t ideal.
LMK what you think and let’s keep chatting about this.
I also did not see a way to define a long string of APA102’s so I could do the mapping in my app. The width and height is limited to uint8_t.
I used Adafruit_GFX stand-alone a few years ago and looked at LEDMatrix and SmartMatrix_GFX. To be honest I find the combinations of SmartMatrix, Adafruit_GFX, LEDMatrix, and FastLED libraries very confusing so appear to have a steep learning curve. I will look into them again.
Setting up my HUB75 with SmatMatrix V5 was quick and easy. I was hoping the same would carry over into the APA102 series.
That’s an oversight on my part, the actual storage of those values is int in the Apa102-related classes, so you can just change that in your sketch to uint16_t to be consistent with the rest of the examples. I’ll commit those changes to the repo as well.
I don’t blame you, this is not a good long term solution.
That’s the end goal. I released APA102 support to the library over three years ago, and if I’m not mistaken, you’re the second person to report that they’re using the APA102 controller, and the first to find any shortcomings with it, so it’s not a very popular feature, otherwise I would have looked at some of these improvements already.
I looked into things more last night and I think I have a better idea of what can be done in the short and long term. In the short term, I believe LEDMatrix can work directly with backgroundLayer in SmartMatrix Library so you can simplify the additional libraries needed down to one. I’ll give that a try myself though I only have 2.5 identical APA102 matrices here to test tiling (one has a dead pixel halfway through).
Long term I need to integrate some of the tiling features that LEDMatrix uses into SmartMatrix Library. To make the APA102 controller mapping on par with the HUB75 controller mapping, the mapping should actually be done between the APA102 controller and the Layers, not a mapping applied on top of just one Layer. That’s going to take more thought and work to get done.
I got really far along the route of figuring out how to make tiling work with SmartMatrix Library. I’m making a mapping example sketch that is just used to generate a map array output over Serial, that looks nearly identical to the code output of the FastLED XY Map Generator.
When you run the mapping sketch, it uses LEDMatrix library to display a test pattern on the screen. You tweak the LEDMatrix parameters until you get a valid test pattern displayed on your tiled matrices. When the mapping is good, it prints out a getPixelFromXYCallback() function and map to the Serial Monitor that you can then paste into your other sketches, and you don’t have to use LEDMatrix again. I may just include LEDMatrix inside the example sketch, as it’s not available in Arduino Library Manager, so it’s not as easy to install as other libraries.
I’m not sure exactly when I’ll get back to this as I have other things going on this weekend, and other tasks I’ve been postponing. Let me know if it seems like I’m on the right track for a solution that works for you.
I decided I wasn’t that far away from finishing, so I kept going. There’s now an Apa102Mapping sketch. You’ll need both FastLED and LEDMatrix installed.
Set kApaMatrixWidth/kApaMatrixHeight, then look at the Setup LEDMatrix Mapping section, and play around with the values there. I added comments that hopefully explain the values better than the LEDMatrix documentation did. You might have a look at their documentation for some context, also this page in the NeoMatrix guide (it’s not using the same variables, but explains the tiling a bit, and the concept is similar. Once when you run the sketch you see a “F” in the right orientation in each tile, and the red and green lines are showing up correctly, open Serial Monitor, press any key and then enter to generate the mapping code. You should also see yellow and blue lines on the tiled matrix
You can then copy the getPixelFromXYCallback() function into FastLed_Panel_Plus_Apa102 (the recently modified version), set kApaMatrixWidth/kApaMatrixHeight, and set ENABLE_APA102_REMAPPING to 1. You should see scrolling text in the right orientation
LMK if you try this, hopefully it works smoothly. I should note that I only actually have 1.5 identical APA102 matrices as one I thought I had was the wrong layout, and I tried fixing the half working matrix with no luck, so I wasn’t able to try more than 1-dimension tiling.