From fca921ee82af79fc3992c06e56097c9e82bf5e76 Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Wed, 26 Nov 2025 22:22:13 +0100 Subject: [PATCH] Adding "Complete" mode to Dissolve FX: always fades completely (#5016) This allows for much slower speed setting to not turn into "twinkle" effect --- wled00/FX.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 22bc3ac9..dda57391 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -713,7 +713,7 @@ uint16_t dissolve(uint32_t color) { if (SEGENV.aux0) { //dissolve to primary/palette if (pixels[i] == SEGCOLOR(1)) { pixels[i] = color == SEGCOLOR(0) ? SEGMENT.color_from_palette(i, true, PALETTE_SOLID_WRAP, 0) : color; - break; //only spawn 1 new pixel per frame per 50 LEDs + break; //only spawn 1 new pixel per frame } } else { //dissolve to secondary if (pixels[i] != SEGCOLOR(1)) { @@ -724,14 +724,27 @@ uint16_t dissolve(uint32_t color) { } } } - // fix for #4401 - for (unsigned i = 0; i < SEGLEN; i++) SEGMENT.setPixelColor(i, pixels[i]); + unsigned incompletePixels = 0; + for (unsigned i = 0; i < SEGLEN; i++) { + SEGMENT.setPixelColor(i, pixels[i]); // fix for #4401 + if (SEGMENT.check2) { + if (SEGENV.aux0) { + if (pixels[i] == SEGCOLOR(1)) incompletePixels++; + } else { + if (pixels[i] != SEGCOLOR(1)) incompletePixels++; + } + } + } if (SEGENV.step > (255 - SEGMENT.speed) + 15U) { SEGENV.aux0 = !SEGENV.aux0; SEGENV.step = 0; } else { - SEGENV.step++; + if (SEGMENT.check2) { + if (incompletePixels == 0) + SEGENV.step++; // only advance step once all pixels have changed + } else + SEGENV.step++; } return FRAMETIME; @@ -744,7 +757,7 @@ uint16_t dissolve(uint32_t color) { uint16_t mode_dissolve(void) { return dissolve(SEGMENT.check1 ? SEGMENT.color_wheel(hw_random8()) : SEGCOLOR(0)); } -static const char _data_FX_MODE_DISSOLVE[] PROGMEM = "Dissolve@Repeat speed,Dissolve speed,,,,Random;!,!;!"; +static const char _data_FX_MODE_DISSOLVE[] PROGMEM = "Dissolve@Repeat speed,Dissolve speed,,,,Random,Complete;!,!;!"; /*