-
-
Notifications
You must be signed in to change notification settings - Fork 281
Description
Is your feature request related to a problem? Please describe.
To prevent memory depletion (by over-allocating too many buses) it would be nice to have a method that returns total amount of RAM needed for particular bus (including settings and backend buffers).
Describe the solution you'd like
At WLED we do not create a bus during startup like in most examples but instead use dynamically created buses using new operator. This means we can continue creating buses at runtime until memory runs out, if we do not track memory usage. Some buses use less RAM than others due to differences in underlying technology (RMT, I2S/DMA, etc) so it is challenging to correctly track RAM use.
It would be nice if we could get information how much total RAM will be used by particular bus before such bus is created.
Something like: NeoPixelBus::GetTotalBuffers() or NeoPixelBus::GetTotalSize() similar to NeoPixelBus::PixelsSize().
Describe alternatives you've considered
We manually track and calculate (empirically) amount of RAM used.
Additional context
Sometimes underlying buffers change (i.e. 3/4 cadence with I2S) which will skew uneducated (empirical) manual tracking.
As some buses share same underlying buffers (i.e. parallel I2S) it is up to the calling application to take care of that.