Hi all. Is there an easy way to change the order of leds in

Hi all. Is there an easy way to change the order of leds in a CRGB array?

Basically I have 8 led strips daisy changed together, arranged in spokes. I’d like to to change to order the spokes are arranged, but in software, and I only need to do it once.

[ 0-9 , 29-20 , 10-19 , 39-30 …]

I feel like I’m missing something simple
Thanks!

look through the group for discussion of “mapping.”

if you look at showleds() in the following code you’ll see that I needed to do some weird mapping (some strips were forward, others were backwards…). Macetech also has some example code floating in the archive.

the easiest was is the setup a virtual array that’s the way that you want to think about it and then have another array that maps that virtual light to it’s actual place on the strip. then before you show led you read from the virtual one and set the actual one…

Thanks Zeke!

That led me down the path to sort out what I wanted to do.

The hurdle I kept running into was trying to get fill_rainbow() to work across my led mapping. In the end I solved this by making a modified version of fill_rainbow() that works across virtualleds in funny orders.
http://pastebin.com/YKUU4nZh

The LED mapping idea that @Andre mentionsis what I’ve done before too.

I use two LED arrays: the real one that FastLED is bound to and a “virtual” one that I pass in to all the FastLED functions like “fill_rainbow()”. Then, I do all the operations on the virtual LEDs, call an “led_swizzle()” function to map virtual to real, then do FastLED.show() as usual.

Sorta like this:

@Tod_Kurt that’s great, it’s nice and simple and lets you use the built in functions without having to modify them. Thanks!