From 71a5cfed4bbe88c51a52b8b2fa4a3244b27c6c45 Mon Sep 17 00:00:00 2001 From: Def3nder <33399267+Def3nder@users.noreply.github.com> Date: Sun, 9 Feb 2020 10:36:37 +0100 Subject: [PATCH] Intensity slider for "Police" and "Two Dots" (#670) Enable intensity slider for the Effects based on "police_base" the intensity slider controls the width of the "dot" from 1 pixel (as now) to 64 pixels. --- wled00/FX.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 12d40278e..43428fd4f 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -1227,6 +1227,7 @@ uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2) { uint16_t counter = now * ((SEGMENT.speed >> 2) +1); uint16_t idexR = (counter * SEGLEN) >> 16; + uint8_t size = 1 + SEGMENT.intensity >> 3; if (idexR >= SEGLEN) idexR = 0; uint16_t topindex = SEGLEN >> 1; @@ -1234,10 +1235,11 @@ uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2) if (SEGENV.call == 0) SEGENV.aux0 = idexR; if (idexB >= SEGLEN) idexB = 0; //otherwise overflow on odd number of LEDs - if (SEGENV.aux0 == idexR) { - setPixelColor(idexR, color1); - setPixelColor(idexB, color2); - } else { + for (uint8_t i=0; i <= size; i++) { + setPixelColor(idexR+i, color1); + setPixelColor(idexB+i, color2); + } + if (SEGENV.aux0 != idexR) { uint8_t gap = (SEGENV.aux0 < idexR)? idexR - SEGENV.aux0:SEGLEN - SEGENV.aux0 + idexR; for (uint8_t i = 0; i <= gap ; i++) { if ((idexR - i) < 0) idexR = SEGLEN-1 + i;