nodemcu-firmware icon indicating copy to clipboard operation
nodemcu-firmware copied to clipboard

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

Open docbacardi opened this issue 3 years ago • 6 comments

Fixes #3508.

  • [x] This PR is for the dev-esp32 branch rather than for the release 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:

  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.

docbacardi avatar Feb 23 '22 18:02 docbacardi

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

pjsg avatar Feb 25 '22 01:02 pjsg

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.

docbacardi avatar Feb 25 '22 08:02 docbacardi

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

HHHartmann avatar Feb 25 '22 13:02 HHHartmann

@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.

jmattsson avatar Jan 30 '24 01:01 jmattsson

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

docbacardi avatar Feb 03 '24 10:02 docbacardi

Please find the patch here: #3629

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

docbacardi avatar Feb 04 '24 12:02 docbacardi