Release of v0.6.2

Added /easter joke subpage
Added Easter (6) effect
Merged Single and Multi Dynamic (7) effects
Added Easter theme
Added North Korea timezone
This commit is contained in:
cschwinne 2018-04-01 00:08:50 +02:00
parent ba04aa7fef
commit 72223c7e42
10 changed files with 96 additions and 62 deletions

View File

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

View File

@ -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<PIXELFEATURE, PIXELMETHOD> {
_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<PIXELFEATURE, PIXELMETHOD> {
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<PIXELFEATURE, PIXELMETHOD> {
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),

View File

@ -2,7 +2,7 @@
<html>
<head><meta charset="utf-8">
<link rel='shortcut icon' type='image/x-icon' href='/favicon.ico'/>
<title>WLED 0.6.1</title>
<title>WLED 0.6.2</title>
<script>
var d=document;
var w=window.getComputedStyle(d.querySelector("html"));
@ -581,8 +581,8 @@
<option value="3">Wipe (3)</option>
<option value="4">Wipe Random (4)</option>
<option value="5">Color R (5)</option>
<option value="6">Single Dynamic (6)</option>
<option value="7">All Dynamic (7)</option>
<option value="6">Easter (6)</option>
<option value="7">Dynamic (7)</option>
<option value="8">Colorloop (8)</option>
<option value="9">Rainbow (9)</option>
<option value="10">Scan (10)</option>

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -155,7 +155,7 @@ Color Theme:
<option value="9">Nixie</option>
<option value="10">Terminal</option>
<option value="11">C64</option>
<option value="12">Placeholder</option>
<option value="12">Easter</option>
<option value="13">Placeholder</option>
<option value="14">The End</option>
<option value="15" id="co">Custom</option>
@ -248,6 +248,7 @@ Time zone:
<option value="10">JST(KST)</option>
<option value="11">AEST/AEDT</option>
<option value="12">NZST/NZDT</option>
<option value="13">North Korea</option>
</select><br>
UTC offset: <input name="UO" type="number" min="-65500" max="65500" required> seconds (max. 18 hours)<br>
Current local time is <span class="times">unknown</span>.
@ -335,7 +336,7 @@ HTTP traffic is unencrypted. An attacker in the same network can intercept form
<button type="button" onclick="U()">Manual OTA Update</button><br>
Enable ArduinoOTA: <input type="checkbox" name="AO"><br>
<h3>About</h3>
<a href="https://github.com/Aircoookie/WLED">WLED</a> version 0.6.1<br>
<a href="https://github.com/Aircoookie/WLED">WLED</a> version 0.6.2<br>
(c) 2016-2018 Christian Schwinne <br>
<i>Licensed under the MIT license</i><br><br>
<i>Uses libraries:</i><br>

View File

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

View File

@ -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, "&#x1F423;&#x1F423;&#x1F423;&#x1F423;&#x1F423;", "You are super special! Here are 5 chicks for you!", 254);}
else if (chance > 230) {serveMessage(200, "&#x1F423;&#x1F423;&#x1F423;&#x1F423;", "You are genuinely special! Here are 4 chicks for you!", 254);}
else if (chance > 200) {serveMessage(200, "&#x1F423;&#x1F423;&#x1F423;", "You are very special! Here are 3 chicks for you!", 254);}
else if (chance > 140) {serveMessage(200, "&#x1F423;&#x1F423;", "You are quite special! Here are 2 chicks for you!", 254);}
else if (chance > 1) {serveMessage(200, "&#x1F423;", "Happy Easter to you! Here's your personal chick!", 254);}
else {serveMessage(200, "&#x1F430;My basket is empty!&#x1F430;", "So sorry you always have bad luck... Why not try again?", 254);}
} else
{
serveMessage(200, "&#x1F608;April Fools!&#x1F608;", "You could try to <a href=\"/settings/ui\">decorate</a> 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
}

View File

@ -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()
{