This weekend I wrote a new non-blocking WS2812 library. I’d like to create a driver for it in FastLED, similar to the one for OctoWS2811. Is there anything I should know, other than just copy of the OctoWS2811 driver and start fiddling? Any tips or style I should follow to have the best chance of eventually having it accepted & merged into FastLED?
Awesome work Paul, I have been thinking of creating a ESP8266/ESP32 driver just like this using Serial(I Already made one that runs via SPI on multiple platforms with 12 bytes per RGB pixel)
I’ve added a FastLED driver here:
Hopefully in time it will get merged into the official FastLED repository. I submitted a pull request, but my guess it’ll take some time to be accepted.
Usage is meant to be drop in replacement for the normal WS2812 clockless driver. Just include WS2812Serial.h, define USE_WS2812SERIAL before including FastLED.h, and then in addLeds use WS2812SERIAL instead of WS2812.
Here’s a working example:
I should mention, the ONLY reason to use this instead of FastLED’s regular clockless WS2812 driver is if you’re having conflicts with interrupts from other libraries. If audio or too much incoming serial data messes up the LEDs, and disabling interrupts messes up the audio or causes data loss, this can help. But it does use more memory, and it ties up one of the serial ports, so only use this as a drop-in replacement for the regular WS2812 driver when those conflicts come up.
Thanks Paul!
@PaulStoffregen Great stuff thanks mate!
Could this potentially help people that have issues with leds flickering when using the esp8266? I have a good work around so it’s not much of an issue for me. It’s more of a curiosity thing for me.
It won’t help at all with esp8266. Well, not unless someone uses it as inspiration to reimplement with code specific to the esp serial port and dma. Even then, this library only solves the problem of interrupt conflicts, which may or may not be the cause of flicker problems.
I have been having a werid issue with a 900pixel matrix that’s been behaving very strangely where at certain update speeds the LEDs jump one or two positions over and back, as if an LED is falling to either correctly detect the start or the sequence or failing to remove it’s self before passing the data on.
No idea why it does it, happens with both esp8266 and teensy, but for whatever reason, this library fixes this. So if you are having crazy issues like this, might be worth a try!