Hi all, in order to don't copy so much data in and out the

Hi all, in order to don’t copy so much data in and out the CRGB leds I wonder if there is an easy way to define this array bigger than NUM_LEDS and manipulate the start adress FastLED.show uses. Any hint is appreciated! Could be usefull for scrolling on a matrix…
edit: I’m dreaming of a function like FastLED.show(int startindex);

I would have a secondary array that’s the bigger size and then just memcpy to the one sized to NUM_LEDS. You would have to do two mempy’s to account for wrap around, but that math is fairly trivial to write

Thanks Mandeep, that’s what I do right now. I just wondered if there is a way without copying to save a bit RAM and have it going faster.

Doesn’t FastLED let you pass in your own array pointer? You could make an array that is size+NUM_LEDS and just keep setting the starting point that way?

Yes, that was my idea. And the question is, how to set the starting point.
edit: In which file could I have a look, what FastLED.show basically does?

Perhaps someone like @Mark_Kriegsman or @Daniel_Garcia would like to give you better advice than me… But you could try creating your own controller by inheriting from the appropriate controller in the FastLED code, and override the show method. Or you could fork FastLED and expose its internal mControllers array, where the starting offset is stored?

@Mandeep_Rai you don’t need to do either of those things. You can just create your own controller and sidestep using the FastLED object to manage things. One of the things on my todo list for 2.1 is to write up examples showing how to do that, and I’ve exposed this functionality just for edge cases like this. You can look in controller.h to see the methods available:

#include<FastLED.h>
#define NUM_LEDS 50
CRGB leds[NUM_LEDS];

WS2811<6,GRB> myLedController;
uint8_t gBrightness;

void setup() {
myLedController.init();
myLedController.setCorrection(TypicalSMD5050);
gBrightness=128;
}

void loop() {
… blah blah do stuff with leds …

myLedController.show(leds, NUM_LEDS,gBrightness);

}

The interfaces are still a little rough, and I may make some more changes to them before we finalize 2.1, but this should give you the rough idea. Since you are calling show and passing in the led structure, you can pass in what you want/how you want.

(ps. There isn’t an array of controllers anymore)

While I respect the art of optimisation, I must say it’s rather more pleasant and productive to just move to a platform that has some RAM and get on with doing new stuff instead :slight_smile:

@Mat_Bettinson I just got done ordering a Teensy 3.1 for that specific reason :slight_smile:

Um, even the teensy is no guarantee of enough ram. I’m hoping to drive 6000 leds off of a due (actually, a digix), which has 96kb of ram, and i’m a little concerned about having enough!

Bit of an edge case :slight_smile: