nodemcu-firmware
nodemcu-firmware copied to clipboard
Use a translator callback to convert GRB data to RMT pulses.
Fixes #3508.
- [x] This PR is for the
dev-esp32
branch rather than for therelease
branch. - [x] This PR is compliant with the other contributing guidelines as well (if not, please describe why).
- [x] I have thoroughly tested my contribution.
- [x] The code changes are reflected in the documentation at
docs/*
.
This patch replaces the custom ISR in ws2812.write with a translator callback. Furthermore it introduces 2 small improvements:
- 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 .
- 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.
This looks plausible to me -- I need to get some ws2812s attached to an esp32 to test.....
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.
But there are other led strips which will not work, so that would be as misleading.
@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.
I will try and port this. Also a good chance to move to the new RMT driver.
Please find the patch here: #3629
The migration to the new RMT code in IDF5 would affect more modules. One step after another...