Repository navigation
RGB LED Fixes - #3536
RGB LED Fixes#3536
Conversation
CapnBry
left a comment
There was a problem hiding this comment.
Wowie, 48 bytes per LED? That's insane! Not your problem but golly, that's so fat for the 3 bytes each LED actually needs to receive.
In ESP32LedDriver::ESP32LedDriver() you calculate out_buffer_size and use that for the malloc, but in the Begin() you tell it to use 2x 1KB buffers and the max number of LEDs is limited to the entire span of both buffers. I'm not familiar with the I2S peripheral but can you quickly explain how the limit for a single update can span 2 buffers and why this wouldn't use the same size as what there is to send?
For the I2S driver we have to tell it the maximum amount of memory to allocate as internal DMA buffer so we tell it 2 x 1KB buffers. The maximum single buffer is 1KB. We could calculate as |
Thanks for the explanation and I am sorry if I am being a bit dense about this, but in |
|
Yup, that's exactly what it does. Thats why theres an extra 4 bytes added as it appends a pointer to the next internal DMA buffer to the end of the first one. |
CapnBry
left a comment
There was a problem hiding this comment.
Tested on an RX (BAYCK) and a TX (Bandit) and it still works, I did not try a long ARGBLED string to the limit.
I was skeptical of the DMA split but that's pretty neat, appreciate the discussion.
Issue
When defining more than 8 LEDs the RX will crash
Problem
The DMA buffers were incorrectly allocated in the RGB code.
Solution
Fixes #3338