From bbf2f6c7de3b04e0d9091b072759137ce9379576 Mon Sep 17 00:00:00 2001 From: fishbone-git Date: Tue, 28 Jan 2020 20:47:37 +0100 Subject: [PATCH 01/10] non-required HUE settings --- wled00/html_settings.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wled00/html_settings.h b/wled00/html_settings.h index c54bf5ff..44f9842b 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -234,13 +234,13 @@ Group Topic:
Reboot required to apply changes. MQTT info

Philips Hue

You can find the bridge IP and the light number in the 'About' section of the hue app.
-Poll Hue light every ms:
+Poll Hue light every ms:
Then, receive On/Off, Brightness, and Color
Hue Bridge IP:
- . - . - . -
+ . + . + . +
Press the pushlink button on the bridge, after that save this page!
(when first connecting)
Hue status: Internal ESP Error!
From e4d5551f168f09e59f14535a9507a2614ac3bf02 Mon Sep 17 00:00:00 2001 From: Def3nder <33399267+Def3nder@users.noreply.github.com> Date: Wed, 29 Jan 2020 23:10:02 +0100 Subject: [PATCH 02/10] Correction for "Percent with speed" (#642) The speed slider defines the "size" of pixels that will be added or substracted each refresh. If this size is bigger than the last value and you quickly move the intensity slider to zero, then the effect shows 100% all the time until it will be changed. --- wled00/FX.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 96880f4d..796a5297 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -3027,7 +3027,7 @@ uint16_t WS2812FX::mode_percent(void) { SEGENV.step += size; if (SEGENV.step > active_leds) SEGENV.step = active_leds; } else if (active_leds < SEGENV.step) { - SEGENV.step -= size; + if (SEGENV.step > size) SEGENV.step -= size; else SEGENV.step = 0; if (SEGENV.step < active_leds) SEGENV.step = active_leds; } From a29e98fd41342ba2d6f32cdd3c4dc9f5f56f12d1 Mon Sep 17 00:00:00 2001 From: Def3nder <33399267+Def3nder@users.noreply.github.com> Date: Wed, 29 Jan 2020 23:20:32 +0100 Subject: [PATCH 03/10] Correct start of Lighthouse effect at high speeds (#643) --- wled00/FX.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 796a5297..bc488b98 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -1039,6 +1039,10 @@ uint16_t WS2812FX::mode_comet(void) { for (uint16_t i = SEGENV.aux0; i < index ; i++) { setPixelColor( i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0)); } + } else if (index < SEGENV.aux0 && index < 10) { + for (uint16_t i = 0; i < index ; i++) { + setPixelColor( i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0)); + } } SEGENV.aux0 = index++; From 50ff59239c15d0fe6225fdc7f3252feb29d4ec80 Mon Sep 17 00:00:00 2001 From: Aircoookie Date: Sat, 1 Feb 2020 00:36:00 +0100 Subject: [PATCH 04/10] Segment grouping HTML support --- wled00/data/index.htm | 123 +++++++++++++++++++++++++++++++++--------- 1 file changed, 97 insertions(+), 26 deletions(-) diff --git a/wled00/data/index.htm b/wled00/data/index.htm index e7ea5e75..4d8cff08 100644 --- a/wled00/data/index.htm +++ b/wled00/data/index.htm @@ -46,6 +46,12 @@ p { color: #ddd; } +td { + text-align: center; + text-transform: uppercase; + font-size: 14px; +} + button { outline: none; cursor: pointer; @@ -86,6 +92,15 @@ button { margin: -2px 0 4px 0; } +table { + table-layout: fixed; + width: 76%; +} + +td { + text-align: center; +} + .slider-icon { transform: translateY(2px); @@ -432,8 +447,8 @@ input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; } -.botpad { - margin-bottom: 16px !important; +.segn { + margin: 3px 0 6px 0 !important; } .ic { @@ -470,11 +485,19 @@ input[type=number]::-webkit-outer-spin-button { } .cnf { - position: absolute; - top: 75px; - right: 60px; - color: #fff; - cursor: pointer; + position: absolute; + top: 66px; + right: 28px; + color: #fff; + cursor: pointer; + background: #333; + padding: 43px 6px; + border-radius: 5px; +} + +.half { + padding: 6px 6px; + top: 64px; } .del { @@ -572,8 +595,13 @@ input[type=number]::-webkit-outer-spin-button { .h { font-size: 13px; + text-align: center; color: #bbb; - text-align: left; + margin-bottom: 5px; +} + +.bp { + margin-bottom: 5px; } .seg { @@ -734,8 +762,8 @@ input[type=number]::-webkit-outer-spin-button {
First preset:
Last preset:
- Time per preset: s
- Transition: s + Time per preset: s
+ Transition: s @@ -864,9 +892,27 @@ function populateSegments(s)
- Start LED:
- Stop LED: - (${inst.stop - inst.start} LED${inst.stop - inst.start > 1 ? "s":""})
+ + + + + + + + + +
Start LEDStop LED
+ + + + + + + + + +
GroupingSpacing
+
${inst.stop - inst.start} LED${inst.stop - inst.start > 1 ? "s":""} (${Math.ceil((inst.stop - inst.start)/(inst.grp + inst.spc))} virtual)
- Start LED:
- Stop LED: - (${ledCount - ns} LEDs)
- + + + + + + + + + +
Start LEDStop LED
+
${ledCount - ns} LEDs
+
`; d.getElementById('segutil').innerHTML = cn; @@ -1130,6 +1194,13 @@ function setSeg(s){ var stop = parseInt(d.getElementById(`seg${s}e`).value); if (stop <= start) {delSeg(s); return;}; var obj = {"seg": {"id": s, "start": start, "stop": stop}}; + if (d.getElementById(`seg${s}grp`)) + { + var grp = parseInt(d.getElementById(`seg${s}grp`).value); + var spc = parseInt(d.getElementById(`seg${s}spc`).value); + obj.seg.grp = grp; + obj.seg.spc = spc; + } requestJson(obj); } From 773d6e002c87de8ef084056d63e4d88918a78528 Mon Sep 17 00:00:00 2001 From: Aircoookie Date: Tue, 4 Feb 2020 17:43:46 +0100 Subject: [PATCH 05/10] Add discourse to readme --- readme.md | 4 +++- wled00/data/index.htm | 53 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/readme.md b/readme.md index 8a9d2ada..cdcd7b76 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,7 @@ ![WLED logo](https://raw.githubusercontent.com/Aircoookie/WLED/master/wled_logo.png) [![](https://img.shields.io/github/release/Aircoookie/WLED.svg?style=flat-square)](https://github.com/Aircoookie/WLED/releases) +[![](https://img.shields.io/discourse/topics?color=%230000ac&label=forum&server=https://wled.discourse.group?style=flat-square)](https://wled.discourse.group) [![](https://img.shields.io/discord/473448917040758787.svg?colorB=blue&label=discord&style=flat-square)](https://discord.gg/KuqP7NE) [![](https://img.shields.io/badge/quick_start-wiki-blue.svg?style=flat-square)](https://github.com/Aircoookie/WLED/wiki) [![](https://img.shields.io/badge/app-wled-blue.svg?style=flat-square)](https://github.com/Aircoookie/WLED-App) @@ -57,7 +58,8 @@ Credits [here](https://github.com/Aircoookie/WLED/wiki/Contributors-&-About)! Uses Linearicons by Perxis! Join the Discord [server](https://discord.gg/KuqP7NE) to discuss everything about WLED! -You can also send me mails to [dev.aircoookie@gmail.com](mailto:dev.aircoookie@gmail.com). +Check out the WLED [Discourse forum](https://wled.discourse.group)! +You can also send me mails to [dev.aircoookie@gmail.com](mailto:dev.aircoookie@gmail.com), but please only do so if you want to talk to me privately. If WLED really brightens up your every day, you can [![](https://img.shields.io/badge/send%20me%20a%20small%20gift-paypal-blue.svg?style=flat-square)](https://paypal.me/aircoookie) *Disclaimer:* diff --git a/wled00/data/index.htm b/wled00/data/index.htm index 4d8cff08..1cc88083 100644 --- a/wled00/data/index.htm +++ b/wled00/data/index.htm @@ -385,7 +385,7 @@ input[type=range]::-ms-thumb { background-color: #333; color: white; border: 0px solid white; - border-radius: 5px; + border-radius: 25px; filter: drop-shadow(0px 0px 2px #000); transition-duration: 0.5s; -webkit-backface-visibility: hidden; @@ -402,13 +402,32 @@ input[type=range]::-ms-thumb { vertical-align: middle; } +.qcs-w { + margin-top: 10px; +} +.qcs { + padding: 14px; + margin: 2px; + border-radius: 14px; + display: inline-block; +} +.qcsb { + padding: 13px; + border: 1px solid white; +} + +.cl { + width: 42px; +} + select { -webkit-appearance: none; -moz-appearance: none; appearance: none; background: url("data:image/svg+xml;utf8,") no-repeat; background-size: 12px; - background-position: 210px 16px; + background-position: 206px 16px; + padding-left: 12px !important; background-repeat: no-repeat; outline: none; } @@ -455,13 +474,13 @@ input[type=number]::-webkit-outer-spin-button { padding: 6px 0 0 0; } -.xs { - width: 60px; +.xxs { + width: 40px; + margin: 6px; } -.xxs { - width: 42px; - margin: 8px; +.rect { + border-radius: 5px; } .psts { @@ -597,7 +616,6 @@ input[type=number]::-webkit-outer-spin-button { font-size: 13px; text-align: center; color: #bbb; - margin-bottom: 5px; } .bp { @@ -680,6 +698,19 @@ input[type=number]::-webkit-outer-spin-button {
+
+
+
+
+
+
+

+
+
+
+
+
R
+
@@ -1179,7 +1210,7 @@ function makeSeg() { } function resetUtil() { - var cn = `
`; + var cn = `
`; d.getElementById('segutil').innerHTML = cn; } @@ -1296,9 +1327,9 @@ function selectSlot(b) { cd[i].style.margin="5px"; cd[i].style.width="42px"; } - cd[csel].style.border="6px solid white"; + cd[csel].style.border="5px solid white"; cd[csel].style.margin="2px"; - cd[csel].style.width="54px"; + cd[csel].style.width="50px"; if (cpick.color.rgbString !== cd[csel].style.backgroundColor) { cpick.color.set(cd[csel].style.backgroundColor); } From fa7092cc17fafced658d47865d962b2f7b18267d Mon Sep 17 00:00:00 2001 From: Aircoookie Date: Tue, 4 Feb 2020 17:46:43 +0100 Subject: [PATCH 06/10] Fix discourse badge --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index cdcd7b76..044344ea 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,7 @@ ![WLED logo](https://raw.githubusercontent.com/Aircoookie/WLED/master/wled_logo.png) [![](https://img.shields.io/github/release/Aircoookie/WLED.svg?style=flat-square)](https://github.com/Aircoookie/WLED/releases) -[![](https://img.shields.io/discourse/topics?color=%230000ac&label=forum&server=https://wled.discourse.group?style=flat-square)](https://wled.discourse.group) +[![](https://img.shields.io/discourse/topics?colorB=blue&label=forum&server=https%3A%2F%2Fwled.discourse.group%2F&style=flat-square)](https://wled.discourse.group) [![](https://img.shields.io/discord/473448917040758787.svg?colorB=blue&label=discord&style=flat-square)](https://discord.gg/KuqP7NE) [![](https://img.shields.io/badge/quick_start-wiki-blue.svg?style=flat-square)](https://github.com/Aircoookie/WLED/wiki) [![](https://img.shields.io/badge/app-wled-blue.svg?style=flat-square)](https://github.com/Aircoookie/WLED-App) From ca1f25ecf6abc9412679d60cc4c320cabf0bc61a Mon Sep 17 00:00:00 2001 From: srg74 <28492985+srg74@users.noreply.github.com> Date: Wed, 5 Feb 2020 19:33:55 -0500 Subject: [PATCH 07/10] Pin order correction (#662) --- platformio.ini | 2 +- usermods/Enclosure_with_OLED_temp_ESP07/wled06_usermod.ino | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platformio.ini b/platformio.ini index c382f924..84200955 100644 --- a/platformio.ini +++ b/platformio.ini @@ -51,7 +51,7 @@ lib_deps_external = https://github.com/crankyoldgit/IRremoteESP8266.git #Time@1.5 #Timezone@1.2.1 - #For use SSD1306 0.91" OLED display uncomment following + #For use SSD1306 OLED display uncomment following #U8g2@~2.27.2 #For Dallas sensor uncomment following 2 lines #DallasTemperature@~3.8.0 diff --git a/usermods/Enclosure_with_OLED_temp_ESP07/wled06_usermod.ino b/usermods/Enclosure_with_OLED_temp_ESP07/wled06_usermod.ino index 31bba9e6..2c55a952 100644 --- a/usermods/Enclosure_with_OLED_temp_ESP07/wled06_usermod.ino +++ b/usermods/Enclosure_with_OLED_temp_ESP07/wled06_usermod.ino @@ -5,7 +5,7 @@ #define U8X8_PIN_SCL 5 #define U8X8_PIN_SDA 4 // Dallas sensor -OneWire oneWire(12); +OneWire oneWire(13); DallasTemperature sensor(&oneWire); long temptimer = millis(); long lastMeasure = 0; @@ -16,9 +16,9 @@ long lastMeasure = 0; // https://github.com/olikraus/u8g2/wiki/u8x8setupcpp // or check the gallery: // https://github.com/olikraus/u8g2/wiki/gallery -// --> First choise of cheap I2C OLED 128X32 +// --> First choise of cheap I2C OLED 128X32 0.91" U8X8_SSD1306_128X32_UNIVISION_HW_I2C u8x8(U8X8_PIN_NONE, U8X8_PIN_SCL, U8X8_PIN_SDA); // Pins are Reset, SCL, SDA -// --> Second choise of cheap I2C OLED 128X64 +// --> Second choise of cheap I2C OLED 128X64 0.96" or 1.3" //U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(U8X8_PIN_NONE, U8X8_PIN_SCL, U8X8_PIN_SDA); // Pins are Reset, SCL, SDA // gets called once at boot. Do all initialization that doesn't depend on // network here From 06a5c1a798ea668f8794c2a92aac6ef6e9ccebd5 Mon Sep 17 00:00:00 2001 From: Def3nder <33399267+Def3nder@users.noreply.github.com> Date: Thu, 6 Feb 2020 01:36:01 +0100 Subject: [PATCH 08/10] Percent Effect from both ends of the strip (#660) from 0 to 100 the strip will get color(0) starting at the ESP, from 200 to 100 to strip will do it the other way around. So, when using this effect for the staircase usermod, a person entering area near the ESP would set an intensity starting with 1 and getting bigger and leaving on the other side would need to further increase the intensity until 200. then the strip has color(1) again. --- wled00/FX.cpp | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index bc488b98..a2f3d27a 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -3013,21 +3013,34 @@ uint16_t WS2812FX::mode_plasma(void) { */ uint16_t WS2812FX::mode_percent(void) { - uint8_t percent = max(0, min(100, SEGMENT.intensity)); - uint16_t active_leds = SEGLEN * percent / 100.0; + uint8_t percent = max(0, min(200, SEGMENT.intensity)); + uint16_t active_leds = (percent < 100) ? SEGLEN * percent / 100.0 + : SEGLEN * (200 - percent) / 100.0; if (SEGENV.call == 0) SEGENV.step = 0; uint8_t size = (1 + ((SEGMENT.speed * SEGLEN) >> 11)) & 0xFF ; - for (uint16_t i = 0; i < SEGLEN; i++) { - if (i < SEGENV.step) { - setPixelColor(i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0)); - } - else { - setPixelColor(i, SEGCOLOR(1)); - } - } - if(active_leds > SEGENV.step) { + if (percent < 100) { + for (uint16_t i = 0; i < SEGLEN; i++) { + if (i < SEGENV.step) { + setPixelColor(i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0)); + } + else { + setPixelColor(i, SEGCOLOR(1)); + } + } + } else { + for (uint16_t i = 0; i < SEGLEN; i++) { + if (i < (SEGLEN - SEGENV.step)) { + setPixelColor(i, SEGCOLOR(1)); + } + else { + setPixelColor(i, color_from_palette(i, true, PALETTE_SOLID_WRAP, 0)); + } + } + } + + if(active_leds > SEGENV.step) { // smooth transition to the target value SEGENV.step += size; if (SEGENV.step > active_leds) SEGENV.step = active_leds; } else if (active_leds < SEGENV.step) { From d69a2f15145e744ffd62c8038023d2ec11e8ac4c Mon Sep 17 00:00:00 2001 From: Def3nder <33399267+Def3nder@users.noreply.github.com> Date: Thu, 6 Feb 2020 01:37:47 +0100 Subject: [PATCH 09/10] Fix Chase Effects at high speeds + "Two Dots" Effect at low speeds (#659) --- wled00/FX.cpp | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index a2f3d27a..1ce19c7f 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -693,6 +693,8 @@ uint16_t WS2812FX::mode_android(void) { uint16_t WS2812FX::chase(uint32_t color1, uint32_t color2, uint32_t color3, bool dopalette) { uint16_t counter = now * (SEGMENT.speed >> 3) + 1; uint16_t a = counter * SEGLEN >> 16; + SEGENV.step = a; + if (SEGENV.call == 0) SEGENV.aux1 = a; // Use intensity setting to vary chase up to 1/2 string length uint16_t b = (a + 1 + (SEGMENT.intensity * SEGLEN >> 10)) % SEGLEN; uint16_t c = (b + 1 + (SEGMENT.intensity * SEGLEN >> 10)) % SEGLEN; @@ -703,6 +705,26 @@ uint16_t WS2812FX::chase(uint32_t color1, uint32_t color2, uint32_t color3, bool setPixelColor(b, color2); setPixelColor(c, color3); + if (a > SEGENV.aux1) { // when speed is too fast, this catches the gaps + for (uint16_t i = SEGENV.aux1; i < a ; i++) { + setPixelColor(i, color1); + uint16_t b1 = (i + 1 + (SEGMENT.intensity * SEGLEN >> 10)) % SEGLEN; + uint16_t c1 = (b1 + 1 + (SEGMENT.intensity * SEGLEN >> 10)) % SEGLEN; + setPixelColor(b1, color2); + setPixelColor(c1, color3); + } + } else if (a < SEGENV.aux1 && a < 10) { // this is for the start of the strip + for (uint16_t i = 0; i < a ; i++) { + setPixelColor(i, color1); + uint16_t b1 = (i + 1 + (SEGMENT.intensity * SEGLEN >> 10)) % SEGLEN; + uint16_t c1 = (b1 + 1 + (SEGMENT.intensity * SEGLEN >> 10)) % SEGLEN; + setPixelColor(b1, color2); + setPixelColor(c1, color3); + SEGENV.step = 0; + } + } + SEGENV.aux1 = a++; + return FRAMETIME; } @@ -1188,20 +1210,23 @@ uint16_t WS2812FX::police_base(uint32_t color1, uint32_t color2) if (idexR >= SEGLEN) idexR = 0; uint16_t topindex = SEGLEN >> 1; - uint16_t idexB = idexR + topindex; + uint16_t idexB = (idexR > topindex) ? idexR - topindex : idexR + topindex; if (SEGENV.call == 0) SEGENV.aux0 = idexR; - - if (idexR > topindex) idexB -= SEGLEN; if (idexB >= SEGLEN) idexB = 0; //otherwise overflow on odd number of LEDs - 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; - if ((idexB - i) < 0) idexB = SEGLEN-1 + i; - setPixelColor(idexR-i, color1); - setPixelColor(idexB-i, color2); + if (SEGENV.aux0 == idexR) { + setPixelColor(idexR, color1); + setPixelColor(idexB, color2); + } else { + 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; + if ((idexB - i) < 0) idexB = SEGLEN-1 + i; + setPixelColor(idexR-i, color1); + setPixelColor(idexB-i, color2); + } + SEGENV.aux0 = idexR; } - SEGENV.aux0 = idexR; return FRAMETIME; } From 37b84300b4ba4c1ddf246f3e1d14fba12e326553 Mon Sep 17 00:00:00 2001 From: Def3nder <33399267+Def3nder@users.noreply.github.com> Date: Sun, 9 Feb 2020 10:33:26 +0100 Subject: [PATCH 10/10] Fix Chase Random effect (#669) --- wled00/FX.cpp | 70 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 25 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 1ce19c7f..12d40278 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -346,7 +346,7 @@ uint16_t WS2812FX::mode_dual_scan(void) { * Cycles all LEDs at once through a rainbow. */ uint16_t WS2812FX::mode_rainbow(void) { - uint16_t counter = (now * ((SEGMENT.speed >> 3) +2)) & 0xFFFF; + uint16_t counter = (now * ((SEGMENT.speed >> 2) +2)) & 0xFFFF; counter = counter >> 8; if (SEGMENT.intensity < 128){ @@ -363,7 +363,7 @@ uint16_t WS2812FX::mode_rainbow(void) { * Cycles a rainbow over the entire string of LEDs. */ uint16_t WS2812FX::mode_rainbow_cycle(void) { - uint16_t counter = (now * ((SEGMENT.speed >> 3) +2)) & 0xFFFF; + uint16_t counter = (now * ((SEGMENT.speed >> 2) +2)) & 0xFFFF; counter = counter >> 8; for(uint16_t i = 0; i < SEGLEN; i++) { @@ -691,39 +691,57 @@ uint16_t WS2812FX::mode_android(void) { * color2 and color3 = colors of two adjacent leds */ uint16_t WS2812FX::chase(uint32_t color1, uint32_t color2, uint32_t color3, bool dopalette) { - uint16_t counter = now * (SEGMENT.speed >> 3) + 1; + uint16_t counter = now * ((SEGMENT.speed >> 2) + 1); uint16_t a = counter * SEGLEN >> 16; SEGENV.step = a; - if (SEGENV.call == 0) SEGENV.aux1 = a; + uint8_t size = 1 + (SEGMENT.intensity * SEGLEN >> 10); + if (SEGENV.call == 0) {SEGENV.aux0 = 0; SEGENV.aux1 = a;} // Use intensity setting to vary chase up to 1/2 string length - uint16_t b = (a + 1 + (SEGMENT.intensity * SEGLEN >> 10)) % SEGLEN; - uint16_t c = (b + 1 + (SEGMENT.intensity * SEGLEN >> 10)) % SEGLEN; + uint16_t b = (a + size) % SEGLEN; + uint16_t c = (b + size) % SEGLEN; if (dopalette) color1 = color_from_palette(a, true, PALETTE_SOLID_WRAP, 1); setPixelColor(a, color1); + if (SEGENV.aux0 == 0) { // catch the first pixels after color change from "chase random" (because they have the "old" color) + for (uint16_t i = 0; i < a; i++) { + uint32_t color = getPixelColor(0); + setPixelColor(i, color1); + } + SEGENV.aux0 = 1; + } setPixelColor(b, color2); setPixelColor(c, color3); - if (a > SEGENV.aux1) { // when speed is too fast, this catches the gaps - for (uint16_t i = SEGENV.aux1; i < a ; i++) { - setPixelColor(i, color1); - uint16_t b1 = (i + 1 + (SEGMENT.intensity * SEGLEN >> 10)) % SEGLEN; - uint16_t c1 = (b1 + 1 + (SEGMENT.intensity * SEGLEN >> 10)) % SEGLEN; - setPixelColor(b1, color2); - setPixelColor(c1, color3); - } - } else if (a < SEGENV.aux1 && a < 10) { // this is for the start of the strip - for (uint16_t i = 0; i < a ; i++) { - setPixelColor(i, color1); - uint16_t b1 = (i + 1 + (SEGMENT.intensity * SEGLEN >> 10)) % SEGLEN; - uint16_t c1 = (b1 + 1 + (SEGMENT.intensity * SEGLEN >> 10)) % SEGLEN; - setPixelColor(b1, color2); - setPixelColor(c1, color3); + if (a != SEGENV.aux1) { // when speed is too fast, this catches the gaps + if (a > SEGENV.aux1) { + for (uint16_t i = SEGENV.aux1; i <= a; i++) { // sometimes the step-length varies from one to the next call - therefor "<= a" and not "< a" + setPixelColor(i, color1); + uint16_t b1 = (i + size) % SEGLEN; + uint16_t c1 = (b1 + size) % SEGLEN; + setPixelColor(b1, color2); + setPixelColor(c1, color3); + } + } else { + for (uint16_t i = SEGENV.aux1; i <= SEGLEN; i++) { // from last position to the end + setPixelColor(i, color1); + uint16_t b1 = (i + size) % SEGLEN; + uint16_t c1 = (b1 + size) % SEGLEN; + setPixelColor(b1, color2); + setPixelColor(c1, color3); + } + for (uint16_t i = 0; i < a; i++) { // from 0 to the actual position + setPixelColor(i, color1); + uint16_t b1 = (i + size) % SEGLEN; + uint16_t c1 = (b1 + size) % SEGLEN; + setPixelColor(b1, color2); + setPixelColor(c1, color3); + } SEGENV.step = 0; - } + SEGENV.aux0 = 0; + } } - SEGENV.aux1 = a++; + SEGENV.aux1 = ++a; return FRAMETIME; } @@ -741,10 +759,12 @@ uint16_t WS2812FX::mode_chase_color(void) { * Primary running followed by random color. */ uint16_t WS2812FX::mode_chase_random(void) { + if (!SEGENV.allocateData(2)) return mode_static(); //allocation failed + if (SEGENV.call == 0) SEGENV.data[0] = 0; if (SEGENV.step == 0) { - SEGENV.aux0 = get_random_wheel_index(SEGENV.aux0); + SEGENV.data[0] = get_random_wheel_index(SEGENV.data[0]); } - return chase(color_wheel(SEGENV.aux0), SEGCOLOR(0), SEGCOLOR(0), false); + return chase(color_wheel(SEGENV.data[0]), SEGCOLOR(0), SEGCOLOR(0), false); }