Hello FASTLED lovers! Im woking with a single ledstrip but is has been cutted

Hello FASTLED lovers!

Im woking with a single ledstrip but is has been cutted in thre (A from 0 to 10, B 10-20 and C 20-30) and custom mounted in a phisical different way (A C B). So I need to configure le ledstrip in A C B order. I thougt that it could be done this way but there is a problem when adding leds on the same pin:

void setup() {
FastLED.addLeds(leds, 0, 10).setCorrection( TypicalLEDStrip );//A 0-10
FastLED.addLeds(leds, 20, 30).setCorrection( TypicalLEDStrip );//C 20-30
FastLED.addLeds(leds, 10, 20).setCorrection( TypicalLEDStrip );//B 10-20
}

The effect is the same as:

void setup() {
FastLED.addLeds(leds, 0, 30).setCorrection( TypicalLEDStrip );//ABC 0-30
}

And of course it looks odd. I was confident that addLeds fuction would respect somehow the sub arrays and the order of the addition.

Even this senctence is not respecting the initial offset of 20 leds.

FastLED.addLeds(leds, 20, 30).setCorrection( TypicalLEDStrip );//C 20-30

I hope I just coded that wrong!

I don´t understand the precise question, but shouldn´t it be 0-9, 20-29 and 10-19?
Use 3 differnt pins instead or one pin and connect the end of one strip to the beginning of the next one.
I would use one pin and write a little mapping function that sorts the things out in the way I need it.

The order is just as you mentioned. The wiring cannot be changed, it has been encapsulated an the other pins are compromised. About the mapping function… Thats what i was trying with the addLeds calls…

So it is basically about the mapping? What about something like

uint16_t XY( uint8_t x, uint8_t y) {
uint16_t i;
if( x == 0) i = y; //A
if( x == 1) i = y+20; //C
if( x == 2) i = y+10; //B
return i;
}

x names the strip, y the position

Thanks Stefan very much!!

The goal is to do that in a way that I can access the strip via just one array, like in this example:

Just with one difference, each strip beeing phisically substrips of the same strip.

This way I can program regardless of the phisical structure underneath.

I think It could be really powerfull!

With my code you have all the leds in one array…
Please try to say in one clear sentence what your goal is. I probably didn´t get it yet.

Just one parameter “i” to go all trough the final strip.

Like in this example:

Ok, so set up one strip:

FastLED.addLeds(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );

Add this function to your code and call SortMyLeds(); before every FastLED.show();
It will swap part B and C:

void SortMyLeds() {
for (byte i=20; i < 30; i++) {
CRGB buffer = leds[i];
leds[i] = leds[i-10];
leds[i-10] = buffer;
}
}

Thanks for the code! I wanted to achieve this in the setup(); via multiple addLeds calls but your code works like a charm!

Thanks @Stefan_Petrick !

Glad I could help out.