nodemcu / nodemcu-firmware

Lua based interactive firmware for ESP8266, ESP8285 and ESP32
https://nodemcu.readthedocs.io
MIT License
7.64k stars 3.12k forks source link

Use a translator callback to convert GRB data to RMT pulses. #3509

Open docbacardi opened 2 years ago

docbacardi commented 2 years ago

Fixes #3508.

This patch replaces the custom ISR in ws2812.write with a translator callback. Furthermore it introduces 2 small improvements: 1) If the hardware supports it, all channels in the write request are placed in a group. This moves the start of all RMT sequences much closer together. On my hardware I observed >=50ns . 2) New optional parameters can set the duration of the reset signal and the duration for the high and low phase of the 0 and 1 symbols. This allows to adapt the timings to many other RGB LEDs.

pjsg commented 2 years ago

This looks plausible to me -- I need to get some ws2812s attached to an esp32 to test.....

docbacardi commented 2 years ago

The module name might have become a little bit misleading. It is not ws2812 specific, but works with a lot of other RGB LEDs. I did my tests with a single SK6812 on the ESP32-C3 devkit. Another unknown LED strip from some home improvement store is on the way.

HHHartmann commented 2 years ago

But there are other led strips which will not work, so that would be as misleading.

jmattsson commented 7 months ago

@docbacardi @pjsg any chance of seeing what needs tweaking to make this compatible with the current IDF5 branch? I'm out of my depth with the RMT stuff.

docbacardi commented 6 months ago

I will try and port this. Also a good chance to move to the new RMT driver.

docbacardi commented 6 months ago

Please find the patch here: #3629

The migration to the new RMT code in IDF5 would affect more modules. One step after another...