From 39344382c798e3251829d0939fdf6a23e6f9aef6 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 22 Dec 2025 18:10:51 +0100 Subject: [PATCH] WS2812FX::service() cleanup - _isServicing is not critical any more -> move back into bitfield - remove experimental deactivated code from WS2812FX::service() --- wled00/FX.h | 6 ++---- wled00/FX_fcn.cpp | 18 +----------------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/wled00/FX.h b/wled00/FX.h index 1dcf5b41..f0510071 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -1247,14 +1247,12 @@ class WS2812FX { // 96 bytes #endif // will require only 1 byte - volatile bool _isServicing; // WLEDMM moved out of struct, so the flag can be updated in one atomic access struct { - //bool _isServicing : 1; - bool bullshit : 1; + bool _isServicing : 1; // can stay inside the bitfield - not critical any more since we have a mutex bool _isOffRefreshRequired : 1; //periodic refresh is required for the strip to remain off. bool _hasWhiteChannel : 1; //bool _triggered : 1; - bool bullshit2 : 1; + bool unusedBit : 1; }; volatile bool _triggered; // WLEDMM moved out of struct, so the flag can be updated in one atomic access diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 0bacc746..563ff11d 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -1955,11 +1955,7 @@ void WS2812FX::service() { //if (_suspend) return; if (elapsed < 2) return; // keep wifi alive if ( !_triggered && (_targetFps != FPS_UNLIMITED) && (_targetFps != FPS_UNLIMITED_AC)) { -#if 0 - if (elapsed < MIN_SHOW_DELAY) return; // WLEDMM too early for service - delivers higher fps -#else if ((elapsed+1) < _frametime) return; // code from upstream - stricter on FPS -#endif } #else // legacy if (elapsed < _frametime) return; @@ -1997,9 +1993,6 @@ void WS2812FX::service() { if (!cctFromRgb || correctWB) busses.setSegmentCCT(seg.currentBri(seg.cct, true), correctWB); for (uint8_t c = 0; c < NUM_COLORS; c++) _colors_t[c] = gamma32(_colors_t[c]); -#if 0 // WARNING this would kill _supersync_ - now = millis() + timebase; -#endif seg.startFrame(); // WLEDMM if (!_triggered && (seg.currentBri(seg.opacity) == 0) && (seg.lastBri == 0)) continue; // WLEDMM skip totally black segments // effect blending (execute previous effect) @@ -2029,23 +2022,14 @@ void WS2812FX::service() { } esp32SemGive(segmentMux); } // end of critical section - if (_triggered) doShow = true; // WLEDMM "triggered" always means "show" #ifdef WLEDMM_FASTPATH _currentSeg = & strip.getMainSegment(); // WLEDMM safe default #endif _virtualSegmentLength = 0; busses.setSegmentCCT(-1); - if(doShow) { -#if 0 && defined(ARDUINO_ARCH_ESP32) // EXPERIMENTAL - enabled this to enforce stricter frametime limits - static unsigned long lastTimeShow = 0; - long tdelta = millis() - lastTimeShow; - if ((lastTimeShow > 0) && (tdelta > 1) && (tdelta < _frametime)) // too early - release CPU to slow down - vTaskDelay((tdelta-1) / portTICK_PERIOD_MS); // "-1" because vTaskDelay() may actually delay longer than requested - lastTimeShow = millis(); -#else + if(doShow || _triggered) { yield(); -#endif show(); _lastServiceShow = nowUp; // WLEDMM use correct timestamp }