diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 1ce19c7f..43428fd4 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); } @@ -1207,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; @@ -1214,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; diff --git a/wled00/data/settings_sync.htm b/wled00/data/settings_sync.htm index 362bb214..af7f757a 100644 --- a/wled00/data/settings_sync.htm +++ b/wled00/data/settings_sync.htm @@ -105,6 +105,9 @@

MQTT

Enable MQTT:
Broker:
+ Port:
+ The MQTT credentials are sent over an unsecured connection.
+ Never use the MQTT password for another service!

Username:
Password:
Client ID:
@@ -113,18 +116,15 @@ 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!
diff --git a/wled00/html_other.h b/wled00/html_other.h index 4111bc6e..c7d3e855 100644 --- a/wled00/html_other.h +++ b/wled00/html_other.h @@ -20,7 +20,7 @@ const char PAGE_msg[] PROGMEM = R"=====( const char PAGE_update[] PROGMEM = R"=====( WLED Update -

WLED Software Update

Installed version: 0.9.0-b1
Download the latest binary:

)====="; +

WLED Software Update

Installed version: 0.9.1
Download the latest binary:

)====="; //new user welcome page diff --git a/wled00/html_settings.h b/wled00/html_settings.h index 44f9842b..86b2cfbf 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -223,7 +223,7 @@ Device Auth token:

MQTT

Enable MQTT:
Broker: -Port:
+Port:
The MQTT credentials are sent over an unsecured connection.
Never use the MQTT password for another service!

Username:
@@ -370,7 +370,7 @@ HTTP traffic is unencrypted. An attacker in the same network can intercept form
Enable ArduinoOTA:

About

-WLED version 0.9.0-b2

+WLED version 0.9.1

Contributors, dependencies and special thanks
A huge thank you to everyone who helped me create WLED!

(c) 2016-2020 Christian Schwinne
diff --git a/wled00/wled00.ino b/wled00/wled00.ino index f2f94145..5b17a6dc 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -3,7 +3,7 @@ */ /* * @title WLED project sketch - * @version 0.9.0-b2 + * @version 0.9.1 * @author Christian Schwinne */ @@ -90,9 +90,9 @@ #endif //version code in format yymmddb (b = daily build) -#define VERSION 2001281 +#define VERSION 2002021 -char versionString[] = "0.9.0-b2"; +char versionString[] = "0.9.1"; //AP and OTA default passwords (for maximum change them!) @@ -115,9 +115,7 @@ char cmDNS[33] = "x"; //mDNS address (placeholder, will char apSSID[33] = ""; //AP off by default (unless setup) byte apChannel = 1; //2.4GHz WiFi AP channel (1-13) byte apHide = 0; //hidden AP SSID -//byte apWaitTimeSecs = 32; //time to wait for connection before opening AP byte apBehavior = 0; //0: Open AP when no connection after boot 1: Open when no connection 2: Always open 3: Only when button pressed for 6 sec -//bool recoveryAPDisabled = false; //never open AP (not recommended) IPAddress staticIP(0, 0, 0, 0); //static IP of ESP IPAddress staticGateway(0, 0, 0, 0); //gateway (router) IP IPAddress staticSubnet(255, 255, 255, 0); //most common subnet in home networks diff --git a/wled00/wled05_init.ino b/wled00/wled05_init.ino index 0d113b46..0cc6ac7e 100644 --- a/wled00/wled05_init.ino +++ b/wled00/wled05_init.ino @@ -152,6 +152,9 @@ void initAP(bool resetAP=false){ void initConnection() { WiFi.disconnect(); //close old connections + #ifdef ESP8266 + WiFi.setPhyMode(WIFI_PHY_MODE_11N); + #endif if (staticIP[0] != 0 && staticGateway[0] != 0) { diff --git a/wled00/wled08_led.ino b/wled00/wled08_led.ino index 786049a0..480b9741 100644 --- a/wled00/wled08_led.ino +++ b/wled00/wled08_led.ino @@ -57,7 +57,7 @@ void setAllLeds() { } -void setLedsStandard() +void setLedsStandard(bool justColors = false) { for (byte i=0; i<4; i++) { @@ -66,6 +66,7 @@ void setLedsStandard() colSecOld[i] = colSec[i]; colSecT[i] = colSec[i]; } + if (justColors) return; briOld = bri; briT = bri; setAllLeds(); @@ -120,7 +121,12 @@ void colorUpdated(int callMode) colIT[i] = col[i]; colSecIT[i] = colSec[i]; } - if (briT == 0 && callMode != 3) resetTimebase(); + if (briT == 0) + { + setLedsStandard(true); //do not color transition if starting from off + if (callMode != 3) resetTimebase(); //effect start from beginning + } + briIT = bri; if (bri > 0) briLast = bri;