I think that is what I am asking I would like to use all of the standard FastLED features on logical_leds[] and have it mapped to the physical order in leds[]. I have been having problems translating some of Mark’s wonderful examples onto a shaped string that I want the patterns to start at a point that is not the physical start of the array, the wrap for the physical end of the array gets complicated.
If you want to use pointers to accomplish this, you could do:
int *logical_leds[NUM_LEDS];
logical_leds[0]=&leds[7];
logical_leds[NUM_LEDS]=&leds[6];
However this will use two bytes on the AVR, which isn’t efficient (the RGB data is already 3 bytes per pixel). @Chaka_September 's logical addressing using int indices has the same problem, but if you have <=256 LEDs, you could use unsigned char (aka uint8_t, which uses one byte) as the data type for the logical_leds[] array, and only use one extra byte per pixel.
If you can define it algorithmically, you might just want to define a function which translates the logical address to the pixel index:
int pixelForLogicalIndex(int logicalIndex) {
return NUM_LEDS - logicalIndex; // or whatever
}
This tradeoff will save you memory but cost CPU cycles. If you can define it mathematically in a preprocessor macro, you won’t spend memory, and the compiler will optimise anything that it can:
#define PIXEL_FOR_LOGICAL_INDEX(L) (NUM_LEDS - L)
leds[PIXEL_FOR_LOGICAL_INDEX(3)] = CRGB(255, 255, 0); // The compiler’s preprocessor will calculate (NUM_LEDS - 3) and substitute it here to avoid calculating it at runtime.
int *logical_leds[NUM_LEDS];
logical_leds[0]=&leds[7];
logical_leds[NUM_LEDS]=&leds[6];
I would continue this for each led either with a line for each or a loop, correct? I am working with 12 leds so it would not be difficult to have a line for each logical pixel.
To work with them I would just treat the logical_leds like the physical leds?
logical_led[0]= CHSV(77,255,128);
If so that would make the wrapping much simpler than what I am currently working with.
If you are interested in seeing the code I am currently using and is functional is here:
@Richard_Bailey I’m sorry I never got around to helping you further with this. I did have an idea that might help you simplify the code: rewire your LEDs. Because it’s a ‘B’, split it into 2 strips/2 data pins. I think you will find it easier to write code and come up with your own effects. What do you think about that?
I do this with my lighting boards for the R2 Builders. To keep the PCB’s compact my LEDs are wired “serpentine” style and in some cases are routed in a completely different order using fiber optics.
To control them, I start the sketch by defining a simple array that maps each LED’s final physical placement to its order in the circuit.