cleanup:
- version increase
- clean up debug messages
- minor fixes in platformio.ini
- fix compilation with -D WLED_DISABLE_2D
helping the compiler to optimize:
- a few more __attribute__((pure))
- fx.cpp marked a few local functions as "static"
Segments are created/deleted on-the-fly; it seems that "local leds" buffers did not follow properly.
* revise segment copy/move constructors
* de-optimize use of local leds (as they need to be re-allocated when segment size changes)
* minor stability improvements
it seems that SEGMENT.blur() is the main bottleneck for many 2D effects.
This change optimizes performance of the function:
* avoid to re-write unchanged pixels
* early exit when blur_amount == 0 (=nothing to do)
* use _fast_ types where possible
I've seen up to 20% speedup with this change.
power estimation results from estimateCurrentAndLimitBri() were too low (example: estimated 1.3Amp, measured 1.6Amp). This change corrects the power calculation. Due to the changed behavior of getPixelColor, powerSum must be used as-is, not scaled down again by brightness.
this optimization avoids to apply brightness two times .
NeoPixelBusLg has already applied global brightness at sPC. Due to internal working of the Lg bus, its sufficient to only post-apply scaling, and set the new (scaled) brightness for the next frame.
* adding an optional parameter to setBrightness(). ApplyPostAdjustments() will only be called if `immediate=true`. Only ABL will use immediate=true, to ensure electrical safety of equipment.
This allows some optimizations of performance, as ApplyPostAdjustments() is time consuming.
* busses.setBrightness(bri) --> applied to all future pixels (fast, lossless)
* busses.setBrightness(bri, true) --> applied directly to all previously set pixels (slower, lossy)
this optimization avoids to apply brightness two times .
NeoPixelBusLg has already applied global brightness at sPC. Due to internal working of the Lg bus, its sufficient to only post-apply scaling, and set the new (scaled) brightness for the next frame.
* adding an optional parameter to setBrightness(). ApplyPostAdjustments() will only be called if `immediate=true`. Only ABL will use immediate=true, to ensure electrical safety of equipment.
This allows some optimizations of performance, as ApplyPostAdjustments() is time consuming.
* busses.setBrightness(bri) --> applied to all future pixels (fast, lossless)
* busses.setBrightness(bri, true) --> applied directly to all previously set pixels (slower, lossy)
* handling of stop = 0 when calculating sizes (avoid unsigned underflow)
* make sure groupLength() is never zero (to avoid div/0)
* gapmaps: check for "(gapSize > 0)" added.
not sure if all the checks are 100% needed, but they will improve robustness in corner cases.
* Avoid uint16 underflow in width() and height(): stop > start is possible, and means "inactive segment".
* use size_t for ledsrgbSize, _dataLen and _usedSegmentData - uint16_t could overflow in some situations.
* try to catch attempts to allocate zero bytes (inactive segment => size 0)
This disables parts of the new feature that might lead to delays, so basicially there is some detection, but no protection any more.
further development needed --> audio_fastpath branch
compile with -D WLEDMM_PROTECT_SERVICE to enable full protection.
* Changes for allowing Alexa to change light color to White when auto-calculating from RGB
* Update alexa.cpp
Indention
* Do not rely on global auto white override
(gets white mode from segment light capabilities)
* alexa.cpp: Removed unnecessary whitespaces
---------
Co-authored-by: Aircoookie <21045690+Aircoookie@users.noreply.github.com>
to have more stable frame times, the minimum delay should be calculated from the time BEFORE strip.show() not after.
This optimization increases CPU load and potentially has negative impact on usermods that check for strip.isUpdating(), so its only enabled with WLEDMM_FASTPATH.
* robustness: Segment::height() should never return 0
* Segment::XY(), Segment::virtualWidth() and Segment::virtualHeight() declared inline in fx.h. The compiler will always inline these functions now, avoiding overhead of call/return. "Knowing" the function body might also enable other optimizations.
--> up to 10% speedup in 2D effects.