Skip to content

Commit

Permalink
Intensity slider for "Police" and "Two Dots" (Aircoookie#670)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Def3nder authored Feb 9, 2020
1 parent c055477 commit 71a5cfe
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1227,17 +1227,19 @@ 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;
uint16_t idexB = (idexR > topindex) ? idexR - topindex : idexR + topindex;
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;
Expand Down

0 comments on commit 71a5cfe

Please sign in to comment.