From 2a829f2e3dc406add45361242b72cdaa077a1034 Mon Sep 17 00:00:00 2001 From: Russell Stringham <45107644+RussStringham@users.noreply.github.com> Date: Mon, 13 Apr 2026 19:23:14 -0600 Subject: [PATCH 01/10] Add moving skip to Chase 2 --- wled00/FX.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 18d61b2167..46f6c1a71a 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -543,26 +543,40 @@ static const char _data_FX_MODE_RAINBOW_CYCLE[] PROGMEM = "Rainbow@!,Size;;!"; /* * Alternating pixels running function. */ -static void running(uint32_t color1, uint32_t color2, bool theatre = false) { +static void running(uint32_t color1, uint32_t color2, bool theatre = false, int skip = 0) { int width = (theatre ? 3 : 1) + (SEGMENT.intensity >> 4); // window uint32_t cycleTime = 50 + (255 - SEGMENT.speed); uint32_t it = strip.now / cycleTime; bool usePalette = color1 == SEGCOLOR(0); + // skip>0: each stripe has (width) lit LEDs with (skip) blacks between them, plus a (skip)-wide + // black gap at each color transition. stripe_len = width*pitch - skip; period = 2*width*pitch. + int pitch = skip + 1; + int stripe_len = width * pitch - skip; + int period = theatre ? width : (2 * width * pitch); + for (unsigned i = 0; i < SEGLEN; i++) { - uint32_t col = color2; + uint32_t col; if (usePalette) color1 = SEGMENT.color_from_palette(i, true, PALETTE_SOLID_WRAP, 0); if (theatre) { - if ((i % width) == SEGENV.aux0) col = color1; + col = ((i % width) == SEGENV.aux0) ? color1 : color2; } else { - int pos = (i % (width<<1)); - if ((pos < SEGENV.aux0-width) || ((pos >= SEGENV.aux0) && (pos < SEGENV.aux0+width))) col = color1; + int pos = ((int)(i % period) - (int)SEGENV.aux0 + period) % period; + if (pos < stripe_len) { + col = (pos % pitch == 0) ? color1 : 0; // foreground stripe + } else if (pos < stripe_len + skip) { + col = 0; // black gap after foreground + } else if (pos < 2 * stripe_len + skip) { + col = (((pos - stripe_len - skip) % pitch) == 0) ? color2 : 0; // background stripe + } else { + col = 0; // black gap after background + } } SEGMENT.setPixelColor(i,col); } if (it != SEGENV.step) { - SEGENV.aux0 = (SEGENV.aux0 +1) % (theatre ? width : (width<<1)); + SEGENV.aux0 = (SEGENV.aux0 + 1) % period; SEGENV.step = it; } } @@ -1160,9 +1174,9 @@ static const char _data_FX_MODE_CHASE_FLASH_RANDOM[] PROGMEM = "Chase Flash Rnd@ * Alternating color/sec pixels running. */ void mode_running_color(void) { - running(SEGCOLOR(0), SEGCOLOR(1)); + running(SEGCOLOR(0), SEGCOLOR(1), false, SEGMENT.custom1 >> 4); } -static const char _data_FX_MODE_RUNNING_COLOR[] PROGMEM = "Chase 2@!,Width;!,!;!"; +static const char _data_FX_MODE_RUNNING_COLOR[] PROGMEM = "Chase 2@!,Width,Skip;!,!;!;;c1=0"; /* From 865e2317f2feb412c0916984636eb4c39ccd4de4 Mon Sep 17 00:00:00 2001 From: Russell Stringham <45107644+RussStringham@users.noreply.github.com> Date: Tue, 14 Apr 2026 22:34:40 -0600 Subject: [PATCH 02/10] use Cs as skip color --- wled00/FX.cpp | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 46f6c1a71a..a3e8b9a384 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -543,34 +543,31 @@ static const char _data_FX_MODE_RAINBOW_CYCLE[] PROGMEM = "Rainbow@!,Size;;!"; /* * Alternating pixels running function. */ -static void running(uint32_t color1, uint32_t color2, bool theatre = false, int skip = 0) { - int width = (theatre ? 3 : 1) + (SEGMENT.intensity >> 4); // window +static void running(uint32_t color1, uint32_t color2, uint32_t color3, int skip, int width) { uint32_t cycleTime = 50 + (255 - SEGMENT.speed); uint32_t it = strip.now / cycleTime; bool usePalette = color1 == SEGCOLOR(0); + bool usePalette2 = usePalette && color2 == color1; // skip>0: each stripe has (width) lit LEDs with (skip) blacks between them, plus a (skip)-wide // black gap at each color transition. stripe_len = width*pitch - skip; period = 2*width*pitch. int pitch = skip + 1; int stripe_len = width * pitch - skip; - int period = theatre ? width : (2 * width * pitch); + int period = 2 * width * pitch; for (unsigned i = 0; i < SEGLEN; i++) { - uint32_t col; - if (usePalette) color1 = SEGMENT.color_from_palette(i, true, PALETTE_SOLID_WRAP, 0); - if (theatre) { - col = ((i % width) == SEGENV.aux0) ? color1 : color2; + int col = color3; + int pos = ((int)(i % period) - (int)SEGENV.aux0 + period) % period; + if (pos < stripe_len && (pos % pitch == 0)) { + if (usePalette) color1 = SEGMENT.color_from_palette(i, true, PALETTE_SOLID_WRAP, 0); + col = color1; // foreground stripe + } else if (pos < stripe_len + skip) { + // col already set + } else if (pos < 2 * stripe_len + skip && (pos % pitch == 0)) { + if (usePalette2) color2 = SEGMENT.color_from_palette(i, true, PALETTE_SOLID_WRAP, 0); + col = color2; // background stripe } else { - int pos = ((int)(i % period) - (int)SEGENV.aux0 + period) % period; - if (pos < stripe_len) { - col = (pos % pitch == 0) ? color1 : 0; // foreground stripe - } else if (pos < stripe_len + skip) { - col = 0; // black gap after foreground - } else if (pos < 2 * stripe_len + skip) { - col = (((pos - stripe_len - skip) % pitch) == 0) ? color2 : 0; // background stripe - } else { - col = 0; // black gap after background - } + // col already set } SEGMENT.setPixelColor(i,col); } @@ -587,7 +584,9 @@ static void running(uint32_t color1, uint32_t color2, bool theatre = false, int * Inspired by the Adafruit examples. */ void mode_theater_chase(void) { - running(SEGCOLOR(0), SEGCOLOR(1), true); + uint32_t color = SEGCOLOR(0); + int skip = 2+(SEGMENT.intensity >> 4); + running(color, color, SEGCOLOR(1), skip, 1); } static const char _data_FX_MODE_THEATER_CHASE[] PROGMEM = "Theater@!,Gap size;!,!;!"; @@ -597,7 +596,9 @@ static const char _data_FX_MODE_THEATER_CHASE[] PROGMEM = "Theater@!,Gap size;!, * Inspired by the Adafruit examples. */ void mode_theater_chase_rainbow(void) { - running(SEGMENT.color_wheel(SEGENV.step), SEGCOLOR(1), true); + uint32_t color = SEGMENT.color_wheel(SEGENV.step); + int skip = 2+(SEGMENT.intensity >> 4); + running(color, color, SEGCOLOR(1), skip, 1); } static const char _data_FX_MODE_THEATER_CHASE_RAINBOW[] PROGMEM = "Theater Rainbow@!,Gap size;,!;!"; @@ -1174,9 +1175,11 @@ static const char _data_FX_MODE_CHASE_FLASH_RANDOM[] PROGMEM = "Chase Flash Rnd@ * Alternating color/sec pixels running. */ void mode_running_color(void) { - running(SEGCOLOR(0), SEGCOLOR(1), false, SEGMENT.custom1 >> 4); + int skip = SEGMENT.custom1 >> 4; + int width = 1+(SEGMENT.intensity >> 4); + running(SEGCOLOR(0), SEGCOLOR(1), SEGCOLOR(2), skip, width); } -static const char _data_FX_MODE_RUNNING_COLOR[] PROGMEM = "Chase 2@!,Width,Skip;!,!;!;;c1=0"; +static const char _data_FX_MODE_RUNNING_COLOR[] PROGMEM = "Chase 2@!,Width,Skip;!,!,!;!;;c1=0"; /* From 0969948104c004c9f6b94a3b5d467c4ed52ee8a1 Mon Sep 17 00:00:00 2001 From: Russell Stringham <45107644+RussStringham@users.noreply.github.com> Date: Tue, 14 Apr 2026 22:57:53 -0600 Subject: [PATCH 03/10] fix code rabbit concern --- wled00/FX.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index a3e8b9a384..06f8beaf7d 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -544,6 +544,8 @@ static const char _data_FX_MODE_RAINBOW_CYCLE[] PROGMEM = "Rainbow@!,Size;;!"; * Alternating pixels running function. */ static void running(uint32_t color1, uint32_t color2, uint32_t color3, int skip, int width) { + if (width < 1) width = 1; + if (skip < 0) skip = 0; uint32_t cycleTime = 50 + (255 - SEGMENT.speed); uint32_t it = strip.now / cycleTime; bool usePalette = color1 == SEGCOLOR(0); From 37814752824df216282850a9d86aed0f8d9a1e2f Mon Sep 17 00:00:00 2001 From: Russell Stringham <45107644+RussStringham@users.noreply.github.com> Date: Tue, 14 Apr 2026 23:10:13 -0600 Subject: [PATCH 04/10] fix color data type --- wled00/FX.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 06f8beaf7d..7270dcda3e 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -558,7 +558,7 @@ static void running(uint32_t color1, uint32_t color2, uint32_t color3, int skip, int period = 2 * width * pitch; for (unsigned i = 0; i < SEGLEN; i++) { - int col = color3; + uint32_t col = color3; int pos = ((int)(i % period) - (int)SEGENV.aux0 + period) % period; if (pos < stripe_len && (pos % pitch == 0)) { if (usePalette) color1 = SEGMENT.color_from_palette(i, true, PALETTE_SOLID_WRAP, 0); From e69efe7228abf4d06fa056bcac38428ed4b2b3da Mon Sep 17 00:00:00 2001 From: Russell Stringham <45107644+RussStringham@users.noreply.github.com> Date: Tue, 14 Apr 2026 23:12:52 -0600 Subject: [PATCH 05/10] Apply suggestion from @coderabbitai[bot] Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- wled00/FX.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 7270dcda3e..b395996033 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -546,20 +546,14 @@ static const char _data_FX_MODE_RAINBOW_CYCLE[] PROGMEM = "Rainbow@!,Size;;!"; static void running(uint32_t color1, uint32_t color2, uint32_t color3, int skip, int width) { if (width < 1) width = 1; if (skip < 0) skip = 0; - uint32_t cycleTime = 50 + (255 - SEGMENT.speed); - uint32_t it = strip.now / cycleTime; - bool usePalette = color1 == SEGCOLOR(0); - bool usePalette2 = usePalette && color2 == color1; - - // skip>0: each stripe has (width) lit LEDs with (skip) blacks between them, plus a (skip)-wide - // black gap at each color transition. stripe_len = width*pitch - skip; period = 2*width*pitch. int pitch = skip + 1; int stripe_len = width * pitch - skip; int period = 2 * width * pitch; + int phase = SEGENV.aux0 % period; for (unsigned i = 0; i < SEGLEN; i++) { - uint32_t col = color3; - int pos = ((int)(i % period) - (int)SEGENV.aux0 + period) % period; + int col = color3; + int pos = ((int)(i % period) - phase + period) % period; if (pos < stripe_len && (pos % pitch == 0)) { if (usePalette) color1 = SEGMENT.color_from_palette(i, true, PALETTE_SOLID_WRAP, 0); col = color1; // foreground stripe @@ -575,7 +569,7 @@ static void running(uint32_t color1, uint32_t color2, uint32_t color3, int skip, } if (it != SEGENV.step) { - SEGENV.aux0 = (SEGENV.aux0 + 1) % period; + SEGENV.aux0 = (phase + 1) % period; SEGENV.step = it; } } From cd0f0ebf7153a3ca37ea32cd38abf12386f76c34 Mon Sep 17 00:00:00 2001 From: Russell Stringham <45107644+RussStringham@users.noreply.github.com> Date: Tue, 14 Apr 2026 23:20:36 -0600 Subject: [PATCH 06/10] fix bugs introduced by code rabbit --- wled00/FX.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index b395996033..6a9f63a24f 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -546,10 +546,13 @@ static const char _data_FX_MODE_RAINBOW_CYCLE[] PROGMEM = "Rainbow@!,Size;;!"; static void running(uint32_t color1, uint32_t color2, uint32_t color3, int skip, int width) { if (width < 1) width = 1; if (skip < 0) skip = 0; - int pitch = skip + 1; + uint32_t cycleTime = 50 + (255 - SEGMENT.speed); + uint32_t it = strip.now / cycleTime; int pitch = skip + 1; int stripe_len = width * pitch - skip; int period = 2 * width * pitch; int phase = SEGENV.aux0 % period; + bool usePalette = color1 == SEGCOLOR(0); + bool usePalette2 = usePalette && color2 == color1; for (unsigned i = 0; i < SEGLEN; i++) { int col = color3; From b485e97a740e82d8869df5389c175f0aea858725 Mon Sep 17 00:00:00 2001 From: Russell Stringham <45107644+RussStringham@users.noreply.github.com> Date: Tue, 14 Apr 2026 23:21:40 -0600 Subject: [PATCH 07/10] fix typo --- wled00/FX.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 6a9f63a24f..d83a208609 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -547,7 +547,8 @@ static void running(uint32_t color1, uint32_t color2, uint32_t color3, int skip, if (width < 1) width = 1; if (skip < 0) skip = 0; uint32_t cycleTime = 50 + (255 - SEGMENT.speed); - uint32_t it = strip.now / cycleTime; int pitch = skip + 1; + uint32_t it = strip.now / cycleTime; + int pitch = skip + 1; int stripe_len = width * pitch - skip; int period = 2 * width * pitch; int phase = SEGENV.aux0 % period; From 63c16223f5fb144f1e87478647b04d623f8b940c Mon Sep 17 00:00:00 2001 From: Russell Stringham <45107644+RussStringham@users.noreply.github.com> Date: Wed, 15 Apr 2026 20:52:52 -0600 Subject: [PATCH 08/10] rename skip to gap --- wled00/FX.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index d83a208609..44a47493c7 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -543,27 +543,27 @@ static const char _data_FX_MODE_RAINBOW_CYCLE[] PROGMEM = "Rainbow@!,Size;;!"; /* * Alternating pixels running function. */ -static void running(uint32_t color1, uint32_t color2, uint32_t color3, int skip, int width) { +static void running(uint32_t color1, uint32_t color2, uint32_t color3, int gap, int width) { if (width < 1) width = 1; - if (skip < 0) skip = 0; + if (gap < 0) gap = 0; uint32_t cycleTime = 50 + (255 - SEGMENT.speed); uint32_t it = strip.now / cycleTime; - int pitch = skip + 1; - int stripe_len = width * pitch - skip; + int pitch = gap + 1; + int stripe_len = width * pitch - gap; int period = 2 * width * pitch; - int phase = SEGENV.aux0 % period; + SEGENV.aux0 %= period; bool usePalette = color1 == SEGCOLOR(0); bool usePalette2 = usePalette && color2 == color1; for (unsigned i = 0; i < SEGLEN; i++) { int col = color3; - int pos = ((int)(i % period) - phase + period) % period; + int pos = ((int)(i % period) - (int)SEGENV.aux0 + period) % period; if (pos < stripe_len && (pos % pitch == 0)) { if (usePalette) color1 = SEGMENT.color_from_palette(i, true, PALETTE_SOLID_WRAP, 0); col = color1; // foreground stripe - } else if (pos < stripe_len + skip) { + } else if (pos < stripe_len + gap) { // col already set - } else if (pos < 2 * stripe_len + skip && (pos % pitch == 0)) { + } else if (pos < 2 * stripe_len + gap && (pos % pitch == 0)) { if (usePalette2) color2 = SEGMENT.color_from_palette(i, true, PALETTE_SOLID_WRAP, 0); col = color2; // background stripe } else { @@ -573,7 +573,7 @@ static void running(uint32_t color1, uint32_t color2, uint32_t color3, int skip, } if (it != SEGENV.step) { - SEGENV.aux0 = (phase + 1) % period; + ++SEGENV.aux0; SEGENV.step = it; } } @@ -585,8 +585,8 @@ static void running(uint32_t color1, uint32_t color2, uint32_t color3, int skip, */ void mode_theater_chase(void) { uint32_t color = SEGCOLOR(0); - int skip = 2+(SEGMENT.intensity >> 4); - running(color, color, SEGCOLOR(1), skip, 1); + int gap = 2+(SEGMENT.intensity >> 4); + running(color, color, SEGCOLOR(1), gap, 1); } static const char _data_FX_MODE_THEATER_CHASE[] PROGMEM = "Theater@!,Gap size;!,!;!"; @@ -597,8 +597,8 @@ static const char _data_FX_MODE_THEATER_CHASE[] PROGMEM = "Theater@!,Gap size;!, */ void mode_theater_chase_rainbow(void) { uint32_t color = SEGMENT.color_wheel(SEGENV.step); - int skip = 2+(SEGMENT.intensity >> 4); - running(color, color, SEGCOLOR(1), skip, 1); + int gap = 2+(SEGMENT.intensity >> 4); + running(color, color, SEGCOLOR(1), gap, 1); } static const char _data_FX_MODE_THEATER_CHASE_RAINBOW[] PROGMEM = "Theater Rainbow@!,Gap size;,!;!"; @@ -1175,11 +1175,11 @@ static const char _data_FX_MODE_CHASE_FLASH_RANDOM[] PROGMEM = "Chase Flash Rnd@ * Alternating color/sec pixels running. */ void mode_running_color(void) { - int skip = SEGMENT.custom1 >> 4; + int gap = SEGMENT.custom1 >> 4; int width = 1+(SEGMENT.intensity >> 4); - running(SEGCOLOR(0), SEGCOLOR(1), SEGCOLOR(2), skip, width); + running(SEGCOLOR(0), SEGCOLOR(1), SEGCOLOR(2), gap, width); } -static const char _data_FX_MODE_RUNNING_COLOR[] PROGMEM = "Chase 2@!,Width,Skip;!,!,!;!;;c1=0"; +static const char _data_FX_MODE_RUNNING_COLOR[] PROGMEM = "Chase 2@!,Width,Gap;!,!,!;!;;c1=0"; /* From cb1ef9adff646bc3dcafd176cadbe0ff6827e3fb Mon Sep 17 00:00:00 2001 From: Russell Stringham <45107644+RussStringham@users.noreply.github.com> Date: Wed, 15 Apr 2026 21:53:26 -0600 Subject: [PATCH 09/10] rename color3 --- wled00/FX.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 44a47493c7..3eb90f535e 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -1179,7 +1179,7 @@ void mode_running_color(void) { int width = 1+(SEGMENT.intensity >> 4); running(SEGCOLOR(0), SEGCOLOR(1), SEGCOLOR(2), gap, width); } -static const char _data_FX_MODE_RUNNING_COLOR[] PROGMEM = "Chase 2@!,Width,Gap;!,!,!;!;;c1=0"; +static const char _data_FX_MODE_RUNNING_COLOR[] PROGMEM = "Chase 2@!,Width,Skip;!,!,G;!;;c1=0"; /* From a0cb51962c178a1aceb284f088e01d1878903333 Mon Sep 17 00:00:00 2001 From: Russell Stringham <45107644+RussStringham@users.noreply.github.com> Date: Thu, 16 Apr 2026 21:19:16 -0600 Subject: [PATCH 10/10] checkmark to enable gap --- wled00/FX.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 3eb90f535e..7ca511c88f 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -1175,11 +1175,11 @@ static const char _data_FX_MODE_CHASE_FLASH_RANDOM[] PROGMEM = "Chase Flash Rnd@ * Alternating color/sec pixels running. */ void mode_running_color(void) { - int gap = SEGMENT.custom1 >> 4; + int gap = SEGMENT.check2 ? SEGMENT.custom1 >> 4 : 0; int width = 1+(SEGMENT.intensity >> 4); running(SEGCOLOR(0), SEGCOLOR(1), SEGCOLOR(2), gap, width); } -static const char _data_FX_MODE_RUNNING_COLOR[] PROGMEM = "Chase 2@!,Width,Skip;!,!,G;!;;c1=0"; +static const char _data_FX_MODE_RUNNING_COLOR[] PROGMEM = "Chase 2@!,Width,Gap,,,,Gap;!,!,G;!;;c1=0"; /*