prevent flickering during OTA

I've almost toasted my wiring due to uncontrolled LED flickering during OTA.
So here is the fix - it prevents any strip updates when OTA is ongoing.
This commit is contained in:
Frank
2024-02-12 21:53:59 +01:00
parent 7593c23105
commit c9b416a4fe
3 changed files with 9 additions and 1 deletions

View File

@@ -1615,6 +1615,8 @@ void WS2812FX::waitUntilIdle(void) {
void WS2812FX::service() {
unsigned long nowUp = millis(); // Be aware, millis() rolls over every 49 days // WLEDMM avoid losing precision
if (OTAisRunning) return; // WLEDMM avoid flickering during OTA
now = nowUp + timebase;
#if defined(ARDUINO_ARCH_ESP32) && defined(WLEDMM_FASTPATH)
if ((_frametime > 2) && (_frametime < 32) && (nowUp - _lastShow) < (_frametime/2)) return; // WLEDMM experimental - stabilizes frametimes but increases CPU load
@@ -1776,6 +1778,8 @@ void WS2812FX::estimateCurrentAndLimitBri() {
}
void WS2812FX::show(void) {
if (OTAisRunning) return; // WLEDMM avoid flickering during OTA
// avoid race condition, capture _callback value
show_callback callback = _callback;
if (callback) callback();