Any tricks to use FastLED with a pre-existing buffer?

Any tricks to use FastLED with a pre-existing buffer? I’m parsing E1.31 and have a full universe of DMX channel data that I’d like to shove out to some pixels without having to copy or manipulate the data within a CRGB structure. I’m just wanting it to churn out a WS2811 stream from my pre-existing buffer. It’s already in the order that it needs to be sent out and doesn’t need to be manipulated. What’s the easiest way to do this with FastLED? Thanks!

Assuming that your DMX pixel data is just three-byte clusters of R, G, and B, you can just tell FastLED to use that existing buffer in the addLeds() line. Then just read from DMX, and call FastLED.show() – bam, no copy, no manipulation.

CRGB is unusual for a C++ class in that (1) all the members are PUBLIC, and (2) this kind of low-level messing around is totally supported. See more extensive notes on this here https://github.com/FastLED/FastLED/wiki/Pixel-reference

If you paste a little code showing what how your DMX data buffer is declared, I can (probably!) show you how to set up FastLED to just use it in-place.

Oh, that’ll make this super simple then. I started throwing together an E1.31 library, mainly for the ESP8266, but added standard Ethernet Shield support today. I figured FastLED would make a good example for the shield, but I currently don’t have one to test. The library is here: GitHub - forkineye/E131: E1.31 (sACN) library for Arduino with ESP8266 support. I’m thinking this is all it would take for a simple E1.31 based pixel driver:

#include <SPI.h>
#include <Ethernet.h>
#include <E131.h>
#include <FastLED.h>

#define NUM_PIXELS 170
#define DATA_PIN 3

byte mac[] = { 0xDE, 0xAD, 0xBE, 0x2F, 0x1E, 0xE3 };

E131 e131;

void setup() {
Serial.begin(115200);
delay(10);

/* Configure via DHCP and listen Unicast on the default port */
e131.begin(mac);

FastLED.addLeds<WS2811, DATA_PIN>((CRGB*)e131.data, NUM_PIXELS);

}

void loop() {
/* Parse a packet and update pixels */
if(e131.parsePacket())
FastLED.show();
}

Something like that should do it! Let us know how it goes, and if you learning anything of note along the way!