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.
This commit is contained in:
Def3nder 2020-02-09 10:36:37 +01:00 committed by GitHub
parent c055477d3b
commit 71a5cfed4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;