From 4c9dc739ae6a4a38c0955aef5d718ae13b32658e Mon Sep 17 00:00:00 2001 From: cschwinne Date: Sun, 15 Apr 2018 15:27:54 +0200 Subject: [PATCH] Release of v0.6.4 Added Limited support of up to 1200 (ESP8266) or 600 (ESP32) LEDs Changed &ND API call to activate Nightight without requiring NL --- wled00/WS2812FX.cpp | 12 ++++++------ wled00/WS2812FX.h | 14 +++++++------- wled00/data/index.htm | 4 ++-- wled00/data/settings_leds.htm | Bin 8086 -> 8066 bytes wled00/data/settings_sec.htm | Bin 7516 -> 7516 bytes wled00/htmls00.h | 4 ++-- wled00/htmls01.h | 4 ++-- wled00/wled00.ino | 15 ++++++--------- wled00/wled01_eeprom.ino | 5 +++-- wled00/wled03_set.ino | 17 ++++++++++++++--- wled00/wled05_init.ino | 15 +++++++++------ 11 files changed, 51 insertions(+), 39 deletions(-) diff --git a/wled00/WS2812FX.cpp b/wled00/WS2812FX.cpp index 0c8388bc..60e1d548 100644 --- a/wled00/WS2812FX.cpp +++ b/wled00/WS2812FX.cpp @@ -1925,7 +1925,7 @@ void WS2812FX::setCronixieDigits(byte d[]) } } -double WS2812FX::getPowerEstimate(byte leds, uint32_t c, byte b) +double WS2812FX::getPowerEstimate(uint16_t leds, uint32_t c, byte b) { double _mARequired = 100; //ESP power double _mul = (double)b/255; @@ -1941,7 +1941,7 @@ double WS2812FX::getPowerEstimate(byte leds, uint32_t c, byte b) //It is NOT guaranteed to stay within the safeAmps margin. //Stay safe with high amperage and have a reasonable safety margin! //I am NOT to be held liable for burned down garages! -double WS2812FX::getSafePowerMultiplier(double safeMilliAmps, byte leds, uint32_t c, byte b) +double WS2812FX::getSafePowerMultiplier(double safeMilliAmps, uint16_t leds, uint32_t c, byte b) { double _mARequired = getPowerEstimate(leds,c,b); if (_mARequired > safeMilliAmps) @@ -1958,7 +1958,7 @@ void WS2812FX::setCCIndex1(byte i1) _counter_ccStep = 0; } -void WS2812FX::setCCIndex2(byte i2) +void WS2812FX::setCCIndex2(uint16_t i2) { if (i2 > _cc_i1) _cc_i2 = i2; if (_cc_i2 >= _led_count) _cc_i2 = _led_count-1; @@ -2003,7 +2003,7 @@ void WS2812FX::setCCFE(bool fe) _counter_ccStep = 0; } -void WS2812FX::setCustomChase(byte i1, byte i2, byte is, byte np, byte ns, byte stp, bool fs, bool fe) +void WS2812FX::setCustomChase(byte i1, uint16_t i2, byte is, byte np, byte ns, byte stp, bool fs, bool fe) { setCCIndex1(i1); setCCIndex2(i2); @@ -2149,13 +2149,13 @@ void WS2812FX::begin(bool supportWhite, uint16_t countPixels, uint8_t pin) //For some reason min and max are not declared here -byte WS2812FX::minval (byte v, byte w) +uint16_t WS2812FX::minval (uint16_t v, uint16_t w) { if (w > v) return v; return w; } -byte WS2812FX::maxval (byte v, byte w) +uint16_t WS2812FX::maxval (uint16_t v, uint16_t w) { if (w > v) return w; return v; diff --git a/wled00/WS2812FX.h b/wled00/WS2812FX.h index d39fe058..7a9ae891 100644 --- a/wled00/WS2812FX.h +++ b/wled00/WS2812FX.h @@ -213,9 +213,9 @@ class WS2812FX { start(void), stop(void), setMode(byte m), - setCustomChase(byte i1, byte i2, byte is, byte np, byte ns, byte stp, bool fs, bool fe), + setCustomChase(byte i1, uint16_t i2, byte is, byte np, byte ns, byte stp, bool fs, bool fe), setCCIndex1(byte i1), - setCCIndex2(byte i2), + setCCIndex2(uint16_t i2), setCCStart(byte is), setCCNum1(byte np), setCCNum2(byte ns), @@ -270,8 +270,8 @@ class WS2812FX { getColor(void); double - getPowerEstimate(byte leds, uint32_t c, byte b), - getSafePowerMultiplier(double safeMilliAmps, byte leds, uint32_t c, byte b); + getPowerEstimate(uint16_t leds, uint32_t c, byte b), + getSafePowerMultiplier(double safeMilliAmps, uint16_t leds, uint32_t c, byte b); private: NeoPixelWrapper *bus; @@ -360,13 +360,10 @@ class WS2812FX { _locked; byte - minval(byte v, byte w), - maxval(byte v, byte w), _mode_index, _speed, _intensity, _cc_i1, - _cc_i2, _cc_is, _cc_num1, _cc_num2, @@ -377,6 +374,9 @@ class WS2812FX { _cronixieDigits; uint16_t + minval(uint16_t v, uint16_t w), + maxval(uint16_t v, uint16_t w), + _cc_i2, _led_count; uint32_t diff --git a/wled00/data/index.htm b/wled00/data/index.htm index 66f26a78..c79496a8 100644 --- a/wled00/data/index.htm +++ b/wled00/data/index.htm @@ -2,7 +2,7 @@ - WLED 0.6.3 + WLED 0.6.4 )====="; @@ -78,7 +78,7 @@ Effect Panel




+LED count:
LEDs are 4-channel type (RGBW):
Apply preset at boot (0 uses defaults)
Default RGB color: @@ -335,7 +335,7 @@ HTTP traffic is unencrypted. An attacker in the same network can intercept form
Enable ArduinoOTA:

About

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

Uses libraries:
diff --git a/wled00/wled00.ino b/wled00/wled00.ino index d74ff7b4..43b66f28 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -3,7 +3,7 @@ */ /* * @title WLED project sketch - * @version 0.6.3 + * @version 0.6.4 * @author Christian Schwinne */ @@ -33,16 +33,13 @@ #include "WS2812FX.h" //version in format yymmddb (b = daily build) -#define VERSION 1804141 -const String versionString = "0.6.3"; +#define VERSION 1804151 +const String versionString = "0.6.4"; //AP and OTA default passwords (change them!) String apPass = "wled1234"; String otaPass = "wledota"; -//If you have an RGBW strip, also uncomment first line in WS2812FX.h! -bool useRGBW = false; - //spiffs FS only useful for debug (only ESP8266) //#define USEFS @@ -62,7 +59,7 @@ byte currentTheme = 0; String clientSSID = "Your_Network"; String clientPass = ""; String cmDNS = "led"; -byte ledCount = 10; //lowered to prevent accidental overcurrent +uint16_t ledCount = 10; //lowered to prevent accidental overcurrent String apSSID = ""; //AP off by default (unless setup) byte apChannel = 1; byte apHide = 0; @@ -72,7 +69,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 = true, useHSBDefault = true; +bool useHSB = true, useHSBDefault = true, useRGBW = false; bool turnOnAtBoot = true; bool initLedsLast = false; byte bootPreset = 0; @@ -105,7 +102,7 @@ String ntpServerName = "0.wled.pool.ntp.org"; byte ccNumPrimary = 2; byte ccNumSecondary = 4; byte ccIndex1 = 0; -byte ccIndex2 = ledCount -1; +uint16_t ccIndex2 = ledCount -1; bool ccFromStart = true, ccFromEnd = false; byte ccStep = 1; byte ccStart = 0; diff --git a/wled00/wled01_eeprom.ino b/wled00/wled01_eeprom.ino index de883c0a..37743c06 100644 --- a/wled00/wled01_eeprom.ino +++ b/wled00/wled01_eeprom.ino @@ -61,7 +61,7 @@ void saveSettingsToEEPROM() EEPROM.write(226, notifyDirectDefault); EEPROM.write(227, apChannel); EEPROM.write(228, apHide); - EEPROM.write(229, ledCount); + EEPROM.write(229, (ledCount >> 0) & 0xFF); EEPROM.write(230, notifyButton); EEPROM.write(231, notifyTwice); EEPROM.write(232, buttonEnabled); @@ -147,6 +147,7 @@ void saveSettingsToEEPROM() EEPROM.write(395, (abs(utcOffsetSecs) >> 8) & 0xFF); EEPROM.write(396, (utcOffsetSecs<0)); //is negative EEPROM.write(397, initLedsLast); + EEPROM.write(398, (ledCount >> 8) & 0xFF); for (int k=0;k<6;k++){ int in = 900+k*8; @@ -259,7 +260,7 @@ void loadSettingsFromEEPROM(bool first) if (apChannel > 13 || apChannel < 1) apChannel = 1; apHide = EEPROM.read(228); if (apHide > 1) apHide = 1; - ledCount = EEPROM.read(229); + ledCount = ((EEPROM.read(229) << 0) & 0xFF) + ((EEPROM.read(398) << 8) & 0xFF00); if (ledCount > 1200) ledCount = 10; notifyButton = EEPROM.read(230); notifyTwice = EEPROM.read(231); buttonEnabled = EEPROM.read(232); diff --git a/wled00/wled03_set.ino b/wled00/wled03_set.ino index 3167e025..966eb8b6 100644 --- a/wled00/wled03_set.ino +++ b/wled00/wled03_set.ino @@ -115,7 +115,11 @@ void handleSettingsSet(byte subPage) if (server.hasArg("LC")) { int i = server.arg("LC").toInt(); - if (i >= 0 && i <= 1200) ledCount = i; + if (i > 0 && i <= 1200) ledCount = i; + //RMT eats up too much RAM + #ifdef ARDUINO_ARCH_ESP32 + if (ledCount > 600) ledCount = 600; + #endif } useRGBW = server.hasArg("EW"); if (server.hasArg("IS")) //ignore settings and save current brightness, colors and fx as default @@ -230,7 +234,6 @@ void handleSettingsSet(byte subPage) int i = server.arg("BF").toInt(); if (i > 0) briMultiplier = i; } - strip.init(useRGBW,ledCount,PIN); } //UI @@ -378,6 +381,7 @@ void handleSettingsSet(byte subPage) } } saveSettingsToEEPROM(); + if (subPage == 2) strip.init(useRGBW,ledCount,PIN); } bool handleSet(String req) @@ -635,6 +639,8 @@ bool handleSet(String req) } } //toggle nightlight mode + bool aNlDef = false; + if (req.indexOf("&ND") > 0) aNlDef = true; pos = req.indexOf("NL="); if (pos > 0) { @@ -644,9 +650,13 @@ bool handleSet(String req) bri = briT; } else { nightlightActive = true; - if (req.indexOf("&ND") <= 0) nightlightDelayMins = req.substring(pos + 3).toInt(); + if (!aNlDef) nightlightDelayMins = req.substring(pos + 3).toInt(); nightlightStartTime = millis(); } + } else if (aNlDef) + { + nightlightActive = true; + nightlightStartTime = millis(); } //set nightlight target brightness pos = req.indexOf("NT="); @@ -715,6 +725,7 @@ bool handleSet(String req) pos = req.indexOf("CM="); if (pos > 0) {ccStep = (req.substring(pos + 3).toInt()); _cc_updated = true;} pos = req.indexOf("CF="); if (pos > 0) {ccFromStart = (req.substring(pos + 3).toInt()); _cc_updated = true;} pos = req.indexOf("CE="); if (pos > 0) {ccFromEnd = (req.substring(pos + 3).toInt()); _cc_updated = true;} + if (ccIndex2 == 255) ccIndex2 = ledCount-1; if (_cc_updated) strip.setCustomChase(ccIndex1, ccIndex2, ccStart, ccNumPrimary, ccNumSecondary, ccStep, ccFromStart, ccFromEnd); //set presets diff --git a/wled00/wled05_init.ino b/wled00/wled05_init.ino index 7e58abee..4d1a2278 100644 --- a/wled00/wled05_init.ino +++ b/wled00/wled05_init.ino @@ -3,15 +3,18 @@ */ void wledInit() -{ +{ + EEPROM.begin(EEPSIZE); + ledCount = ((EEPROM.read(229) << 0) & 0xFF) + ((EEPROM.read(398) << 8) & 0xFF00); if (ledCount > 1200) ledCount = 10; + //RMT eats up too much RAM + #ifdef ARDUINO_ARCH_ESP32 + if (ledCount > 600) ledCount = 600; + #endif + if (!EEPROM.read(397)) strip.init(EEPROM.read(372),ledCount,PIN); //quick init + Serial.begin(115200); Serial.setTimeout(50); - EEPROM.begin(EEPSIZE); - Serial.println("PreStripInit"); - if (!EEPROM.read(397)) strip.init(EEPROM.read(372),EEPROM.read(229),PIN); //quick init - Serial.println("PostStripInit"); - #ifdef USEFS SPIFFS.begin(); #endif