diff --git a/wled00/WS2812FX.cpp b/wled00/WS2812FX.cpp index 5998fdcfe..61a53d8b6 100644 --- a/wled00/WS2812FX.cpp +++ b/wled00/WS2812FX.cpp @@ -322,31 +322,35 @@ void WS2812FX::mode_random_color(void) { /* - * Lights every LED in a random color. Changes one random LED after the other - * to another random color. + * Lights some pastel colors */ -void WS2812FX::mode_single_dynamic(void) { - if(_counter_mode_call == 0) { - for(uint16_t i=0; i < _led_count; i++) { - if (!_locked[i]) - setPixelColor(i, color_wheel(random(256))); - } - } - int ran = random(_led_count); - if (!_locked[ran]) - setPixelColor(ran, color_wheel(random(256))); - show(); - _mode_delay = 10 + ((5000 * (uint32_t)(SPEED_MAX - _speed)) / SPEED_MAX); +void WS2812FX::mode_easter(void) { + //uint32_t cols[]{0x00F7ECC5,0x00F8D5C7,0x00F9E2E7,0x00BED9D4,0x00F7ECC5,0x00F8D5C7,0x00F9E2E7}; + uint32_t cols[]{0x00FF8040,0x00E5D241,0x0077FF77,0x0077F0F0,0x00FF8040,0x00E5D241,0x0077FF77}; + mode_colorful_internal(cols); } /* * Lights multiple random leds in a random color (higher intensity, more updates) */ -void WS2812FX::mode_multi_dynamic(void) { - for(uint16_t i=0; i < _led_count; i++) { - if (!_locked[i] && random(256)<=_intensity) - setPixelColor(i, color_wheel(random(256))); +void WS2812FX::mode_dynamic(void) { + if(_counter_mode_call == 0) { + for(uint16_t i=0; i < _led_count; i++) { + if (!_locked[i]) + setPixelColor(i, color_wheel(random(256))); + } + } + if (_intensity > 0) //multi dynamic + { + for(uint16_t i=0; i < _led_count; i++) { + if (!_locked[i] && random(256)<_intensity) + setPixelColor(i, color_wheel(random(256))); + } + } else { //single dynamic + int ran = random(_led_count); + if (!_locked[ran]) + setPixelColor(ran, color_wheel(random(256))); } show(); _mode_delay = 100 + ((5000 * (uint32_t)(SPEED_MAX - _speed)) / SPEED_MAX); @@ -1024,14 +1028,20 @@ void WS2812FX::mode_chase_rainbow_white(void) { _mode_delay = 10 + ((30 * (uint32_t)(SPEED_MAX - _speed)) / _led_count); } - /* * Red - Amber - Green - Blue lights running */ void WS2812FX::mode_colorful(void) { uint32_t cols[]{0x00FF0000,0x00EEBB00,0x0000EE00,0x000077CC,0x00FF0000,0x00EEBB00,0x0000EE00}; + mode_colorful_internal(cols); +} + +/* + * Common function for 4-color-running (Colorful, easter) + */ +void WS2812FX::mode_colorful_internal(uint32_t cols[]) { int i = 0; - for (i; i < _led_count-3 ; i+=4) + for (i; i < _led_count ; i+=4) { if(!_locked[i])setPixelColor(i, cols[_counter_mode_step]); if(!_locked[i+1])setPixelColor(i+1, cols[_counter_mode_step+1]); @@ -1057,7 +1067,7 @@ void WS2812FX::mode_colorful(void) { show(); if (_speed > SPEED_MIN) _counter_mode_step++; //static if lowest speed if (_counter_mode_step >3) _counter_mode_step = 0; - _mode_delay = 100 + (25 * (uint32_t)(SPEED_MAX - _speed)); + _mode_delay = 50 + (15 * (uint32_t)(SPEED_MAX - _speed)); } diff --git a/wled00/WS2812FX.h b/wled00/WS2812FX.h index 6baf26129..d9c0f9ae0 100644 --- a/wled00/WS2812FX.h +++ b/wled00/WS2812FX.h @@ -78,8 +78,8 @@ #define FX_MODE_COLOR_WIPE 3 #define FX_MODE_COLOR_WIPE_RANDOM 4 #define FX_MODE_RANDOM_COLOR 5 -#define FX_MODE_SINGLE_DYNAMIC 6 -#define FX_MODE_MULTI_DYNAMIC 7 +#define FX_MODE_EASTER 6 +#define FX_MODE_DYNAMIC 7 #define FX_MODE_RAINBOW 8 #define FX_MODE_RAINBOW_CYCLE 9 #define FX_MODE_SCAN 10 @@ -143,8 +143,8 @@ class WS2812FX : public NeoPixelBrightnessBus { _mode[FX_MODE_COLOR_WIPE] = &WS2812FX::mode_color_wipe; _mode[FX_MODE_COLOR_WIPE_RANDOM] = &WS2812FX::mode_color_wipe_random; _mode[FX_MODE_RANDOM_COLOR] = &WS2812FX::mode_random_color; - _mode[FX_MODE_SINGLE_DYNAMIC] = &WS2812FX::mode_single_dynamic; - _mode[FX_MODE_MULTI_DYNAMIC] = &WS2812FX::mode_multi_dynamic; + _mode[FX_MODE_EASTER] = &WS2812FX::mode_easter; + _mode[FX_MODE_DYNAMIC] = &WS2812FX::mode_dynamic; _mode[FX_MODE_RAINBOW] = &WS2812FX::mode_rainbow; _mode[FX_MODE_RAINBOW_CYCLE] = &WS2812FX::mode_rainbow_cycle; _mode[FX_MODE_SCAN] = &WS2812FX::mode_scan; @@ -309,8 +309,8 @@ class WS2812FX : public NeoPixelBrightnessBus { mode_color_wipe(void), mode_color_wipe_random(void), mode_random_color(void), - mode_single_dynamic(void), - mode_multi_dynamic(void), + mode_easter(void), + mode_dynamic(void), mode_breath(void), mode_fade(void), mode_scan(void), @@ -339,6 +339,7 @@ class WS2812FX : public NeoPixelBrightnessBus { mode_chase_flash_random(void), mode_chase_rainbow_white(void), mode_colorful(void), + mode_colorful_internal(uint32_t*), mode_traffic_light(void), mode_color_sweep_random(void), mode_running_color(void), diff --git a/wled00/data/index.htm b/wled00/data/index.htm index e524ae319..e20000f39 100644 --- a/wled00/data/index.htm +++ b/wled00/data/index.htm @@ -2,7 +2,7 @@ - WLED 0.6.1 + WLED 0.6.2 )====="; @@ -84,8 +84,8 @@ Effect Panel

- - + + diff --git a/wled00/htmls01.h b/wled00/htmls01.h index 64864561e..1b439547c 100644 --- a/wled00/htmls01.h +++ b/wled00/htmls01.h @@ -155,7 +155,7 @@ Color Theme: - + @@ -248,6 +248,7 @@ Time zone: +
UTC offset: seconds (max. 18 hours)
Current local time is unknown. @@ -335,7 +336,7 @@ HTTP traffic is unencrypted. An attacker in the same network can intercept form
Enable ArduinoOTA:

About

-WLED version 0.6.1
+WLED version 0.6.2
(c) 2016-2018 Christian Schwinne
Licensed under the MIT license

Uses libraries:
diff --git a/wled00/wled00.ino b/wled00/wled00.ino index 6ca156eac..163ffe7dd 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -3,7 +3,7 @@ */ /* * @title WLED project sketch - * @version 0.6.1 + * @version 0.6.2 * @author Christian Schwinne */ @@ -33,8 +33,8 @@ #include "WS2812FX.h" //version in format yymmddb (b = daily build) -#define VERSION 1803182 -const String versionString = "0.6.1"; +#define VERSION 1804011 +const String versionString = "0.6.2"; //AP and OTA default passwords (change them!) String apPass = "wled1234"; @@ -72,7 +72,7 @@ IPAddress staticIP(0, 0, 0, 0); IPAddress staticGateway(0, 0, 0, 0); IPAddress staticSubnet(255, 255, 255, 0); IPAddress staticDNS(8, 8, 8, 8); //only for NTP -bool useHSB = false, useHSBDefault = false; +bool useHSB = true, useHSBDefault = true; bool turnOnAtBoot = true; bool initLedsLast = false; byte bootPreset = 0; diff --git a/wled00/wled05_init.ino b/wled00/wled05_init.ino index a0c66d832..4e9ab16ba 100644 --- a/wled00/wled05_init.ino +++ b/wled00/wled05_init.ino @@ -21,27 +21,6 @@ void wledInit() buildCssColorString(); userBeginPreConnection(); - WiFi.disconnect(); //close old connections - - if (staticIP[0] != 0) - { - WiFi.config(staticIP, staticGateway, staticSubnet, staticDNS); - } else - { - WiFi.config(0U, 0U, 0U); - } - - if (apSSID.length()>0) - { - DEBUG_PRINT("USING AP"); - DEBUG_PRINTLN(apSSID.length()); - initAP(); - } else - { - DEBUG_PRINTLN("NO AP"); - WiFi.softAPdisconnect(true); - } - initCon(); DEBUG_PRINTLN(""); @@ -78,6 +57,26 @@ void wledInit() } //SERVER INIT + //seasonal greetings + server.on("/easter", HTTP_GET, [](){ + if (currentTheme == 12) + { + effectCurrent = 6; + strip.setMode(effectCurrent); + effectSpeed = 200; + strip.setSpeed(effectSpeed); + uint8_t chance = random(255); + if (chance > 250) {serveMessage(200, "🐣🐣🐣🐣🐣", "You are super special! Here are 5 chicks for you!", 254);} + else if (chance > 230) {serveMessage(200, "🐣🐣🐣🐣", "You are genuinely special! Here are 4 chicks for you!", 254);} + else if (chance > 200) {serveMessage(200, "🐣🐣🐣", "You are very special! Here are 3 chicks for you!", 254);} + else if (chance > 140) {serveMessage(200, "🐣🐣", "You are quite special! Here are 2 chicks for you!", 254);} + else if (chance > 1) {serveMessage(200, "🐣", "Happy Easter to you! Here's your personal chick!", 254);} + else {serveMessage(200, "🐰My basket is empty!🐰", "So sorry you always have bad luck... Why not try again?", 254);} + } else + { + serveMessage(200, "😈April Fools!😈", "You could try to decorate for Easter first!", 254); + } + }); //settings page server.on("/settings", HTTP_GET, [](){ serveSettings(0); @@ -324,6 +323,26 @@ void initAP(){ void initCon() { + WiFi.disconnect(); //close old connections + + if (staticIP[0] != 0) + { + WiFi.config(staticIP, staticGateway, staticSubnet, staticDNS); + } else + { + WiFi.config(0U, 0U, 0U); + } + + if (apSSID.length()>0) + { + DEBUG_PRINT("USING AP"); + DEBUG_PRINTLN(apSSID.length()); + initAP(); + } else + { + DEBUG_PRINTLN("NO AP"); + WiFi.softAPdisconnect(true); + } int fail_count = 0; if (clientSSID.length() <1 || clientSSID.equals("Your_Network")) fail_count = apWaitTimeSecs*2; WiFi.begin(clientSSID.c_str(), clientPass.c_str()); @@ -341,7 +360,6 @@ void initCon() } if (millis()-lastTry > 499) { con = (WiFi.status() == WL_CONNECTED); - if (con) DEBUG_PRINTLN("rofl"); lastTry = millis(); DEBUG_PRINTLN("C_NC"); if (!recoveryAPDisabled && fail_count > apWaitTimeSecs*2) @@ -374,6 +392,7 @@ void buildCssColorString() case 9: cs[0]="f70"; cs[1]="421"; cs[2]="221"; cs[3]="a50"; cs[4]="f70"; cs[5]="f70"; break;//nixie case 10: cs[0]="2d2"; cs[1]="010"; cs[2]="121"; cs[3]="060"; cs[4]="040"; cs[5]="3f3"; break; //terminal case 11: cs[0]="867ADE"; cs[1]="4033A3"; cs[2]="483AAA"; cs[3]="483AAA"; cs[4]=""; cs[5]="867ADE"; break; //c64 + case 12: cs[0]="fbe8a6"; cs[1]="d2fdff"; cs[2]="b4dfe5"; cs[3]="f4976c"; cs[4]=""; cs[5]="303c6c"; break; //c64 case 14: cs[0]="fc7"; cs[1]="49274a"; cs[2]="94618e"; cs[3]="f4decb"; cs[4]="0008"; cs[5]="f4decb"; break; //end case 15: for (int i=0;i<6;i++)cs[i]=cssCol[i];//custom } diff --git a/wled00/wled10_ntp.ino b/wled00/wled10_ntp.ino index c3224764f..772a119c7 100644 --- a/wled00/wled10_ntp.ino +++ b/wled00/wled10_ntp.ino @@ -49,7 +49,10 @@ TimeChangeRule NZDT = {Second, Sun, Sep, 2, 780 }; //Daylight time = UTC + 13 TimeChangeRule NZST = {First, Sun, Apr, 3, 720 }; //Standard time = UTC + 12 hours Timezone tzNZ(NZDT, NZST); -Timezone* timezones[] = { &tzUTC, &tzUK, &tzEUCentral, &tzEUEastern, &tzUSEastern, &tzUSCentral, &tzUSMountain, &tzUSArizona, &tzUSPacific, &tzChina, &tzJapan, &tzAUEastern, &tzNZ}; +TimeChangeRule NKST = {Last, Sun, Mar, 1, 510}; //Pyongyang Time = UTC + 8.5 hours +Timezone tzNK(NKST, NKST); + +Timezone* timezones[] = {&tzUTC, &tzUK, &tzEUCentral, &tzEUEastern, &tzUSEastern, &tzUSCentral, &tzUSMountain, &tzUSArizona, &tzUSPacific, &tzChina, &tzJapan, &tzAUEastern, &tzNZ, &tzNK}; void handleNetworkTime() {