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
This commit is contained in:
cschwinne 2018-04-15 15:27:54 +02:00
parent a665607fac
commit 4c9dc739ae
11 changed files with 51 additions and 39 deletions

View File

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

View File

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

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.3</title>
<title>WLED 0.6.4</title>
<script>
var d=document;
var w=window.getComputedStyle(d.querySelector("html"));
@ -590,7 +590,7 @@
<svg id="fmf" onclick="SwFX(1)"><use xlink:href="#lnr-arrow-right-circle"></use></svg>
<svg id="fof" onclick="SwFX(99)"><use xlink:href="#lnr-rocket"></use></svg><br><br>
<select name="TX" onchange="GX()">
<option value="0" selected>Static (0)</option>
<option value="0" selected>Solid (0)</option>
<option value="1">Blink (1)</option>
<option value="2">Breath (2)</option>
<option value="3">Wipe (3)</option>

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -85,7 +85,7 @@ const char PAGE_settings_leds1[] PROGMEM = R"=====(
<div class="helpB"><button type="button" onclick="H()">?</button></div>
<button type="button" onclick="B()">Back</button><button type="submit">Save</button><hr>
<h2>LED setup</h2>
LED count (max. 255): <input name="LC" type="number" min="1" max="255" required><br>
LED count: <input name="LC" type="number" min="1" max="1200" required><br>
LEDs are 4-channel type (RGBW): <input type="checkbox" name="EW"><br>
Apply preset <input name="BP" type="number" min="0" max="25" required> at boot (0 uses defaults)<br>
Default RGB color:
@ -335,7 +335,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.3<br>
<a href="https://github.com/Aircoookie/WLED">WLED</a> version 0.6.4<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.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;

View File

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

View File

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

View File

@ -4,14 +4,17 @@
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