From 577d80d2efd7bdad6878f8be0e318319b882d7c6 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sun, 21 Dec 2025 23:08:50 +0100 Subject: [PATCH] segment drawing robustness improvements * segment::fill() is also called outside the service loop - make sure that size is always calculated correctly * leave _currentSeg in a meaningful state after strip.service() --- wled00/FX_fcn.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 9d931dfb..72b3b6ce 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -1443,8 +1443,9 @@ void Segment::refreshLightCapabilities() { void __attribute__((hot)) Segment::fill(uint32_t c) { if (!isActive()) return; // not active - const uint_fast16_t cols = is2D() ? virtualWidth() : virtualLength(); // WLEDMM use fast int types - const uint_fast16_t rows = virtualHeight(); // will be 1 for 1D + // WLEDMM use "calc_" functions because fill() is also called from json.cpp without previous seg.startFrame + const uint_fast16_t cols = is2D() ? calc_virtualWidth() : calc_virtualLength(); // WLEDMM use fast int types + const uint_fast16_t rows = calc_virtualHeight(); // will be 1 for 1D if (is2D()) { // pre-calculate scaled color @@ -2013,6 +2014,9 @@ void WS2812FX::service() { } 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) {