New LED hardware driver: WLED Pixel Bus - #5704
Conversation
still not working
…dy to avoid multiple sendouts
|
@willmmiles I made a lot of updates and it is now in a pretty good shape. I compiled a TODO list in WLEDpixelBus.cpp with the important things that still should be updated / checked / fixed, all of them are improvements that do not need immediate fixing. |
|
OK! I should be able to get some time to do a detailed review on the weekend. |
|
I'm finding it challenging to review this properly - I just keep exploding in a hundred nitpicks. It's hard to know where to start and I feel bad pushing suggestions in dribs and drabs. Bigger things I've noticed so far:
|
|
Thanks for taking a dive.
Fully understand, its a major overhaul and a "diamond in the rough", I also did not start out with a full concept but kept adding and replacing things (as you can see in the PR having over 200 commits). Each time I read through the code I find things that could be done better or more clearly but let's do it in increments, its just too much code to have a clean overview and its easy to get lost in details.
This was actually intentional - I did try to keep current code & structure intact as much as possible, also to not change things and loose backwards compatibility. I am not saying it's the way it has to be in the end.
I did not build it up to be an independent library - but ultimately that should be the goal. I did focus on getting the drivers to work and somehow integrate them and less on making it as clean - as I am sure you can tell ;)
Agreed, the point from above applies here as well: I kept the old structure to not get tangled up and keep my focus on the pixel-pushing driver. I am not sure on where to make the split i.e. should the WLEDpixelBus replace bus digital or be more of an independent library.
sounds like a good idea, I have no real grasp on that concept though - it's a bit above my every-day C++ knowledge but I am sure I can learn that abstraction level. Maybe we should have a call to discuss some of this? |
This is a major update adding WLED Pixel Bus written from scratch to replace NeoPixelBus and it packs a lot of useful features. From a user perspective the main improvements are less memory use and dynamic adjustment of LED timing to eliminate flickering by fine-tuning the timing from -30% to + 30% in 10% steps (dropdown menu).
The new hardware driver structure allows for fully dynamic updates of LED outputs and LED timings. It also adds glitch free parallel SPI output support on the C3 as well as parallel bit-banging on all platforms including ESP8266.
All parallel outputs (except bit-bang) use ping-pong DMA buffers instead of fully pre-filled buffers - memory usage is optimized and DMA buffers are independent of number of LEDs. Also the calculation from LED colors to DMA buffers is highly speed optimized, making the driver blazing fast - I saw 30% FPS improvements in some cases.
The fully dynamic nature of the driver allows for a "Custom digital bus" in the LED settings to support virtually any LED bus type out there - specify timing, number of color channels, invert any color channel or set any color channel combination. The driver also supports inverting the output signal on any pin (ESP32 only).
The LED config UI was updated to fully support the new driver options.
A lot more testing is required for all different kind of LEDs on all platforms. I am sure there is a ton of bugs and kinks to iron out.
I would like to take this opportunity to thank @Makuna for his outstanding work on NeoPixelBus which served me well as a reference on hardware configurations and special LED types.
ESP32 flash and RAM usage comparison (bit bang disabled)
using NeoPixelBus
RAM: [== ] 24.9% (used 81576 bytes from 327680 bytes)
Flash: [======== ] 83.1% (used 1306493 bytes from 1572864 bytes)
Free Heap: (6 outputs, 256 each): 79.8k
using WLEDpixelBus
RAM: [== ] 24.9% (used 81680 bytes from 327680 bytes)
Flash: [======== ] 83.0% (used 1306053 bytes from 1572864 bytes)
Free Heap: (6 outputs, 256 each): 92.8k
Summary by CodeRabbit