added settings for alexa, led count, advanced

included bin files
This commit is contained in:
cschwinne 2017-02-24 23:21:48 +01:00
parent 255cef8685
commit 5748423942
12 changed files with 127 additions and 13 deletions

Binary file not shown.

View File

@ -28,6 +28,10 @@ Upload speed: 115200
Quick start guide: Quick start guide:
-If you do not plan to change the software, you can use the supplied binary files instead-
Just flash a basic HTTP OTA updater sketch and upload the bin!
1. Make sure your ESP module has a min. 4MB SPI flash module. (currently working on supporting 1MB modules) 1. Make sure your ESP module has a min. 4MB SPI flash module. (currently working on supporting 1MB modules)
Connect a WS2812B RGB led strip to GPIO2. Optionally connect a NO-pushbutton to GPIO0 (internal pull-up) and ground. Connect a WS2812B RGB led strip to GPIO2. Optionally connect a NO-pushbutton to GPIO0 (internal pull-up) and ground.

View File

@ -1458,5 +1458,10 @@ void WS2812FX::unlockAll()
_locked[x] = false; _locked[x] = false;
} }
void WS2812FX::setLedCount(uint16_t i)
{
_led_count = i;
}

View File

@ -245,6 +245,7 @@ class WS2812FX : public Adafruit_NeoPixel {
unlockRange(int i, int i2), unlockRange(int i, int i2),
unlockAll(void), unlockAll(void),
trigger(void), trigger(void),
setLedCount(uint16_t i),
setFade(int sp); setFade(int sp);
boolean boolean

View File

@ -32,6 +32,7 @@
document.S_form.APPASS.value = this.responseXML.getElementsByTagName('appass')[0].innerHTML; //fake pass like ****** document.S_form.APPASS.value = this.responseXML.getElementsByTagName('appass')[0].innerHTML; //fake pass like ******
document.S_form.APCHAN.value = this.responseXML.getElementsByTagName('apchan')[0].innerHTML; document.S_form.APCHAN.value = this.responseXML.getElementsByTagName('apchan')[0].innerHTML;
document.S_form.DESC.value = this.responseXML.getElementsByTagName('desc')[0].innerHTML; document.S_form.DESC.value = this.responseXML.getElementsByTagName('desc')[0].innerHTML;
document.S_form.LEDCN.value = this.responseXML.getElementsByTagName('ledcn')[0].innerHTML;
document.S_form.CLDFR.value = this.responseXML.getElementsByTagName('cldef')[0].innerHTML; document.S_form.CLDFR.value = this.responseXML.getElementsByTagName('cldef')[0].innerHTML;
document.S_form.CLDFG.value = this.responseXML.getElementsByTagName('cldef')[1].innerHTML; document.S_form.CLDFG.value = this.responseXML.getElementsByTagName('cldef')[1].innerHTML;
document.S_form.CLDFB.value = this.responseXML.getElementsByTagName('cldef')[2].innerHTML; document.S_form.CLDFB.value = this.responseXML.getElementsByTagName('cldef')[2].innerHTML;
@ -52,8 +53,14 @@
document.S_form.NSDIR.checked = (this.responseXML.getElementsByTagName('nsdir')[0].innerHTML)!=0?true:false; document.S_form.NSDIR.checked = (this.responseXML.getElementsByTagName('nsdir')[0].innerHTML)!=0?true:false;
document.S_form.NSBTN.checked = (this.responseXML.getElementsByTagName('nsbtn')[0].innerHTML)!=0?true:false; document.S_form.NSBTN.checked = (this.responseXML.getElementsByTagName('nsbtn')[0].innerHTML)!=0?true:false;
document.S_form.NSFWD.checked = (this.responseXML.getElementsByTagName('nsfwd')[0].innerHTML)!=0?true:false; document.S_form.NSFWD.checked = (this.responseXML.getElementsByTagName('nsfwd')[0].innerHTML)!=0?true:false;
document.S_form.ALEXA.checked = (this.responseXML.getElementsByTagName('alexa')[0].innerHTML)!=0?true:false;
document.S_form.AINVN.value = this.responseXML.getElementsByTagName('ainvn')[0].innerHTML;
document.S_form.NSALX.checked = (this.responseXML.getElementsByTagName('nsalx')[0].innerHTML)!=0?true:false;
document.S_form.NTPON.checked = (this.responseXML.getElementsByTagName('ntpon')[0].innerHTML)!=0?true:false; document.S_form.NTPON.checked = (this.responseXML.getElementsByTagName('ntpon')[0].innerHTML)!=0?true:false;
document.getElementsByClassName("times")[0].innerHTML = this.responseXML.getElementsByTagName('times')[0].innerHTML; document.getElementsByClassName("times")[0].innerHTML = this.responseXML.getElementsByTagName('times')[0].innerHTML;
document.S_form.OLDEF.value = this.responseXML.getElementsByTagName('oldef')[0].innerHTML;
document.S_form.WOFFS.value = this.responseXML.getElementsByTagName('woffs')[0].innerHTML;
document.S_form.WOFFN.checked = (this.responseXML.getElementsByTagName('woffn')[0].innerHTML)!=0?true:false;
document.S_form.NOOTA.checked = (this.responseXML.getElementsByTagName('noota')[0].innerHTML)!=0?true:false; document.S_form.NOOTA.checked = (this.responseXML.getElementsByTagName('noota')[0].innerHTML)!=0?true:false;
document.S_form.NORAP.checked = (this.responseXML.getElementsByTagName('norap')[0].innerHTML)!=0?true:false; document.S_form.NORAP.checked = (this.responseXML.getElementsByTagName('norap')[0].innerHTML)!=0?true:false;
document.getElementsByClassName("sip")[0].innerHTML = this.responseXML.getElementsByTagName('sip')[0].innerHTML; document.getElementsByClassName("sip")[0].innerHTML = this.responseXML.getElementsByTagName('sip')[0].innerHTML;
@ -116,6 +123,7 @@
<h3>Web setup</h3> <h3>Web setup</h3>
Server description: <input name="DESC" maxlength="32"> <br> Server description: <input name="DESC" maxlength="32"> <br>
<h3>LED setup</h3> <h3>LED setup</h3>
LED count (max. 255): <input name="LEDCN" maxlength="3" size="2"> <br>
Default RGB color: Default RGB color:
<input name="CLDFR" maxlength="3" size="2"> <input name="CLDFR" maxlength="3" size="2">
<input name="CLDFG" maxlength="3" size="2"> <input name="CLDFG" maxlength="3" size="2">
@ -142,10 +150,18 @@
Send notifications on direct change: <input type="checkbox" name="NSDIR" value="0"> <br> Send notifications on direct change: <input type="checkbox" name="NSDIR" value="0"> <br>
Send notifications on button press: <input type="checkbox" name="NSBTN" value="0"> <br> Send notifications on button press: <input type="checkbox" name="NSBTN" value="0"> <br>
Send nightlight notifications: <input type="checkbox" name="NSFWD" value="0"> <br> Send nightlight notifications: <input type="checkbox" name="NSFWD" value="0"> <br>
<h3>Time</h3> <h3>Interfaces</h3>
Warning! NTP was updated but could still cause crashes. Requires reboot. <br> Emulate Alexa device: <input type="checkbox" name="ALEXA" value="0"> <br>
Alexa invocation name: <input name="AINVN" maxlength="32"><br>
Send Alexa notifications: <input type="checkbox" name="NSALX" value="0"> <br>
<h3>Time (highly experimental!)</h3>
<b> Warning! </b>NTP was updated but still causes crashes. Requires reboot. <br>
It is really not recommended to use this! <br>
Get time from NTP server: <input type="checkbox" name="NTPON" value="0"> <br> Get time from NTP server: <input type="checkbox" name="NTPON" value="0"> <br>
Current local time is <span class="times">unknown</span> <br> Current local time is <span class="times">unknown</span> <br>
<h3>Advanced</h3>
Default overlay ID: <input name="OLDEF" maxlength="3" size="2"> <br>
WARLS offset: <input name="WOFFS" maxlength="3" size="2"> negative <input type="checkbox" name="WOFFN" value="0"><br>
<h3>Security</h3> <h3>Security</h3>
OTA locked: <input type="checkbox" name="NOOTA" value="0"> <br> OTA locked: <input type="checkbox" name="NOOTA" value="0"> <br>
Passphrase: <input type="password" name="OPASS" maxlength="32"> <br> Passphrase: <input type="password" name="OPASS" maxlength="32"> <br>
@ -167,6 +183,7 @@
<i>ESP8266 Arduino Core</i> <br> <i>ESP8266 Arduino Core</i> <br>
<i>WS2812FX by kitesurfer1404 (Aircoookie fork)</i> <br> <i>WS2812FX by kitesurfer1404 (Aircoookie fork)</i> <br>
<i>Timezone library by JChristensen</i> <br> <i>Timezone library by JChristensen</i> <br>
<i>arduino-esp8266-alexa-multiple-wemo-switch by kakopappa</i> <br>
Server message: <span class="msg"> XML response error! </span> Server message: <span class="msg"> XML response error! </span>
<br><br> <br><br>
<input type="submit" name="SUBM" value="Save"> <input type="submit" name="SUBM" value="Save">

View File

@ -36,6 +36,7 @@ const char PAGE_settings[] PROGMEM = R"=====(
document.S_form.APPASS.value = this.responseXML.getElementsByTagName('appass')[0].innerHTML; //fake pass like ****** document.S_form.APPASS.value = this.responseXML.getElementsByTagName('appass')[0].innerHTML; //fake pass like ******
document.S_form.APCHAN.value = this.responseXML.getElementsByTagName('apchan')[0].innerHTML; document.S_form.APCHAN.value = this.responseXML.getElementsByTagName('apchan')[0].innerHTML;
document.S_form.DESC.value = this.responseXML.getElementsByTagName('desc')[0].innerHTML; document.S_form.DESC.value = this.responseXML.getElementsByTagName('desc')[0].innerHTML;
document.S_form.LEDCN.value = this.responseXML.getElementsByTagName('ledcn')[0].innerHTML;
document.S_form.CLDFR.value = this.responseXML.getElementsByTagName('cldef')[0].innerHTML; document.S_form.CLDFR.value = this.responseXML.getElementsByTagName('cldef')[0].innerHTML;
document.S_form.CLDFG.value = this.responseXML.getElementsByTagName('cldef')[1].innerHTML; document.S_form.CLDFG.value = this.responseXML.getElementsByTagName('cldef')[1].innerHTML;
document.S_form.CLDFB.value = this.responseXML.getElementsByTagName('cldef')[2].innerHTML; document.S_form.CLDFB.value = this.responseXML.getElementsByTagName('cldef')[2].innerHTML;
@ -56,8 +57,14 @@ const char PAGE_settings[] PROGMEM = R"=====(
document.S_form.NSDIR.checked = (this.responseXML.getElementsByTagName('nsdir')[0].innerHTML)!=0?true:false; document.S_form.NSDIR.checked = (this.responseXML.getElementsByTagName('nsdir')[0].innerHTML)!=0?true:false;
document.S_form.NSBTN.checked = (this.responseXML.getElementsByTagName('nsbtn')[0].innerHTML)!=0?true:false; document.S_form.NSBTN.checked = (this.responseXML.getElementsByTagName('nsbtn')[0].innerHTML)!=0?true:false;
document.S_form.NSFWD.checked = (this.responseXML.getElementsByTagName('nsfwd')[0].innerHTML)!=0?true:false; document.S_form.NSFWD.checked = (this.responseXML.getElementsByTagName('nsfwd')[0].innerHTML)!=0?true:false;
document.S_form.ALEXA.checked = (this.responseXML.getElementsByTagName('alexa')[0].innerHTML)!=0?true:false;
document.S_form.AINVN.value = this.responseXML.getElementsByTagName('ainvn')[0].innerHTML;
document.S_form.NSALX.checked = (this.responseXML.getElementsByTagName('nsalx')[0].innerHTML)!=0?true:false;
document.S_form.NTPON.checked = (this.responseXML.getElementsByTagName('ntpon')[0].innerHTML)!=0?true:false; document.S_form.NTPON.checked = (this.responseXML.getElementsByTagName('ntpon')[0].innerHTML)!=0?true:false;
document.getElementsByClassName("times")[0].innerHTML = this.responseXML.getElementsByTagName('times')[0].innerHTML; document.getElementsByClassName("times")[0].innerHTML = this.responseXML.getElementsByTagName('times')[0].innerHTML;
document.S_form.OLDEF.value = this.responseXML.getElementsByTagName('oldef')[0].innerHTML;
document.S_form.WOFFS.value = this.responseXML.getElementsByTagName('woffs')[0].innerHTML;
document.S_form.WOFFN.checked = (this.responseXML.getElementsByTagName('woffn')[0].innerHTML)!=0?true:false;
document.S_form.NOOTA.checked = (this.responseXML.getElementsByTagName('noota')[0].innerHTML)!=0?true:false; document.S_form.NOOTA.checked = (this.responseXML.getElementsByTagName('noota')[0].innerHTML)!=0?true:false;
document.S_form.NORAP.checked = (this.responseXML.getElementsByTagName('norap')[0].innerHTML)!=0?true:false; document.S_form.NORAP.checked = (this.responseXML.getElementsByTagName('norap')[0].innerHTML)!=0?true:false;
document.getElementsByClassName("sip")[0].innerHTML = this.responseXML.getElementsByTagName('sip')[0].innerHTML; document.getElementsByClassName("sip")[0].innerHTML = this.responseXML.getElementsByTagName('sip')[0].innerHTML;
@ -120,6 +127,7 @@ const char PAGE_settings[] PROGMEM = R"=====(
<h3>Web setup</h3> <h3>Web setup</h3>
Server description: <input name="DESC" maxlength="32"> <br> Server description: <input name="DESC" maxlength="32"> <br>
<h3>LED setup</h3> <h3>LED setup</h3>
LED count (max. 255): <input name="LEDCN" maxlength="3" size="2"> <br>
Default RGB color: Default RGB color:
<input name="CLDFR" maxlength="3" size="2"> <input name="CLDFR" maxlength="3" size="2">
<input name="CLDFG" maxlength="3" size="2"> <input name="CLDFG" maxlength="3" size="2">
@ -146,10 +154,18 @@ const char PAGE_settings[] PROGMEM = R"=====(
Send notifications on direct change: <input type="checkbox" name="NSDIR" value="0"> <br> Send notifications on direct change: <input type="checkbox" name="NSDIR" value="0"> <br>
Send notifications on button press: <input type="checkbox" name="NSBTN" value="0"> <br> Send notifications on button press: <input type="checkbox" name="NSBTN" value="0"> <br>
Send nightlight notifications: <input type="checkbox" name="NSFWD" value="0"> <br> Send nightlight notifications: <input type="checkbox" name="NSFWD" value="0"> <br>
<h3>Time</h3> <h3>Interfaces</h3>
Warning! NTP was updated but could still cause crashes. Requires reboot. <br> Emulate Alexa device: <input type="checkbox" name="ALEXA" value="0"> <br>
Alexa invocation name: <input name="AINVN" maxlength="32"><br>
Send Alexa notifications: <input type="checkbox" name="NSALX" value="0"> <br>
<h3>Time (highly experimental!)</h3>
<b> Warning! </b>NTP was updated but still causes crashes. Requires reboot. <br>
It is really not recommended to use this! <br>
Get time from NTP server: <input type="checkbox" name="NTPON" value="0"> <br> Get time from NTP server: <input type="checkbox" name="NTPON" value="0"> <br>
Current local time is <span class="times">unknown</span> <br> Current local time is <span class="times">unknown</span> <br>
<h3>Advanced</h3>
Default overlay ID: <input name="OLDEF" maxlength="3" size="2"> <br>
WARLS offset: <input name="WOFFS" maxlength="3" size="2"> negative <input type="checkbox" name="WOFFN" value="0"><br>
<h3>Security</h3> <h3>Security</h3>
OTA locked: <input type="checkbox" name="NOOTA" value="0"> <br> OTA locked: <input type="checkbox" name="NOOTA" value="0"> <br>
Passphrase: <input type="password" name="OPASS" maxlength="32"> <br> Passphrase: <input type="password" name="OPASS" maxlength="32"> <br>
@ -171,6 +187,7 @@ const char PAGE_settings[] PROGMEM = R"=====(
<i>ESP8266 Arduino Core</i> <br> <i>ESP8266 Arduino Core</i> <br>
<i>WS2812FX by kitesurfer1404 (Aircoookie fork)</i> <br> <i>WS2812FX by kitesurfer1404 (Aircoookie fork)</i> <br>
<i>Timezone library by JChristensen</i> <br> <i>Timezone library by JChristensen</i> <br>
<i>arduino-esp8266-alexa-multiple-wemo-switch by kakopappa</i> <br>
Server message: <span class="msg"> XML response error! </span> Server message: <span class="msg"> XML response error! </span>
<br><br> <br><br>
<input type="submit" name="SUBM" value="Save"> <input type="submit" name="SUBM" value="Save">

View File

@ -22,7 +22,7 @@
#include "CallbackFunction.h" #include "CallbackFunction.h"
//to toggle usb serial debug (un)comment following line //to toggle usb serial debug (un)comment following line
#define DEBUG //#define DEBUG
#ifdef DEBUG #ifdef DEBUG
#define DEBUG_PRINT(x) Serial.print (x) #define DEBUG_PRINT(x) Serial.print (x)
@ -40,8 +40,8 @@
* @author Christian Schwinne * @author Christian Schwinne
*/ */
//Hardware-settings (only changeble via code) //Hardware-settings (only changeble via code)
#define LEDCOUNT 9 #define LEDCOUNT 255 //maximum, exact count set-able via settings
#define MAXDIRECT 52 //for direct access like arls, should be >= LEDCOUNT #define MAXDIRECT 255 //for direct access like arls, should be >= LEDCOUNT
uint8_t buttonPin = 0; //needs pull-up uint8_t buttonPin = 0; //needs pull-up
uint8_t auxPin = 15; //use e.g. for external relay uint8_t auxPin = 15; //use e.g. for external relay
uint8_t auxDefaultState = 0; //0: input 1: high 2: low uint8_t auxDefaultState = 0; //0: input 1: high 2: low
@ -58,6 +58,7 @@ TimeChangeRule *tcr; //pointer to the time change rule, use to get the TZ
time_t local; time_t local;
//Default CONFIG //Default CONFIG
uint8_t ledcount = 255;
String serverDescription = "WLED 0.3pd"; String serverDescription = "WLED 0.3pd";
String clientssid = "Your_Network_Here"; String clientssid = "Your_Network_Here";
String clientpass = "Dummy_Pass"; String clientpass = "Dummy_Pass";
@ -92,6 +93,7 @@ IPAddress ntpServerIP;
const char* ntpServerName = "time.nist.gov"; const char* ntpServerName = "time.nist.gov";
//overlay stuff //overlay stuff
uint8_t overlayDefault = 0;
int overlayMin = 0, overlayMax = 9; int overlayMin = 0, overlayMax = 9;
int analogClock12pixel = 25; int analogClock12pixel = 25;
boolean analogClockSecondsTrail = false; boolean analogClockSecondsTrail = false;
@ -107,7 +109,7 @@ boolean realtimeEnabled = true;
//alexa //alexa
boolean alexaEnabled = true; boolean alexaEnabled = true;
String alexaInvocationName = "Schloss"; String alexaInvocationName = "Light";
boolean alexaNotify = false; boolean alexaNotify = false;
double transitionResolution = 0.011; double transitionResolution = 0.011;
@ -157,6 +159,7 @@ unsigned long countdownTime = 1483225200L;
int arlsTimeoutMillis = 2500; int arlsTimeoutMillis = 2500;
boolean arlsTimeout = false; boolean arlsTimeout = false;
long arlsTimeoutTime; long arlsTimeoutTime;
boolean arlsSign = true;
uint8_t auxTime = 0; uint8_t auxTime = 0;
unsigned long auxStartTime; unsigned long auxStartTime;
boolean auxActive, auxActiveBefore; boolean auxActive, auxActiveBefore;

View File

@ -43,7 +43,7 @@ void saveSettingsToEEPROM()
EEPROM.write(226, notifyDirect); EEPROM.write(226, notifyDirect);
EEPROM.write(227, apchannel); EEPROM.write(227, apchannel);
EEPROM.write(228, aphide); EEPROM.write(228, aphide);
EEPROM.write(229, LEDCOUNT); EEPROM.write(229, ledcount);
EEPROM.write(230, notifyButton); EEPROM.write(230, notifyButton);
EEPROM.write(231, notifyNightlight); EEPROM.write(231, notifyNightlight);
EEPROM.write(232, buttonEnabled); EEPROM.write(232, buttonEnabled);
@ -90,6 +90,15 @@ void saveSettingsToEEPROM()
//329 reserved for dst setting //329 reserved for dst setting
EEPROM.write(330, useGammaCorrectionBri); EEPROM.write(330, useGammaCorrectionBri);
EEPROM.write(331, useGammaCorrectionRGB); EEPROM.write(331, useGammaCorrectionRGB);
EEPROM.write(332, overlayDefault);
EEPROM.write(333, alexaEnabled);
for (int i = 334; i < 366; ++i)
{
EEPROM.write(i, alexaInvocationName.charAt(i-334));
}
EEPROM.write(366, alexaNotify);
EEPROM.write(367, arlsSign);
EEPROM.write(368, abs(arlsOffset));
EEPROM.commit(); EEPROM.commit();
} }
@ -137,7 +146,7 @@ void loadSettingsFromEEPROM()
if (apchannel > 13 || apchannel < 1) apchannel = 1; if (apchannel > 13 || apchannel < 1) apchannel = 1;
aphide = EEPROM.read(228); aphide = EEPROM.read(228);
if (aphide > 1) aphide = 1; if (aphide > 1) aphide = 1;
//LEDCOUNT = EEPROM.read(229); ledcount = EEPROM.read(229);
notifyButton = EEPROM.read(230); notifyButton = EEPROM.read(230);
notifyNightlight = EEPROM.read(231); notifyNightlight = EEPROM.read(231);
buttonEnabled = EEPROM.read(232); buttonEnabled = EEPROM.read(232);
@ -183,4 +192,16 @@ void loadSettingsFromEEPROM()
ntpEnabled = EEPROM.read(327); ntpEnabled = EEPROM.read(327);
useGammaCorrectionBri = EEPROM.read(330); useGammaCorrectionBri = EEPROM.read(330);
useGammaCorrectionRGB = EEPROM.read(331); useGammaCorrectionRGB = EEPROM.read(331);
overlayDefault = EEPROM.read(332);
alexaEnabled = EEPROM.read(333);
alexaInvocationName = "";
for (int i = 334; i < 366; ++i)
{
if (EEPROM.read(i) == 0) break;
alexaInvocationName += char(EEPROM.read(i));
}
alexaNotify = EEPROM.read(366);
arlsSign = EEPROM.read(367);
arlsOffset = EEPROM.read(368);
if (!arlsSign) arlsOffset = -arlsOffset;
} }

View File

@ -100,6 +100,9 @@ void XML_response_settings()
resp = resp + "<desc>"; resp = resp + "<desc>";
resp = resp + serverDescription; resp = resp + serverDescription;
resp = resp + "</desc>"; resp = resp + "</desc>";
resp = resp + "<ledcn>";
resp = resp + ledcount;
resp = resp + "</ledcn>";
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
resp = resp + "<cldef>"; resp = resp + "<cldef>";
@ -153,11 +156,26 @@ void XML_response_settings()
resp = resp + "<ntpon>"; resp = resp + "<ntpon>";
resp = resp + bool2int(ntpEnabled); resp = resp + bool2int(ntpEnabled);
resp = resp + "</ntpon>"; resp = resp + "</ntpon>";
resp = resp + "<alexa>";
resp = resp + bool2int(alexaEnabled);
resp = resp + "</alexa><ainvn>";
resp = resp + alexaInvocationName;
resp = resp + "</ainvn><nsalx>";
resp = resp + bool2int(alexaNotify);
resp = resp + "</nsalx>";
DEBUG_PRINTLN("pretime"); DEBUG_PRINTLN("pretime");
resp = resp + "<times>"; resp = resp + "<times>";
resp = resp + getTimeString(); resp = resp + getTimeString();
resp = resp + "</times>"; resp = resp + "</times>";
DEBUG_PRINTLN("posttime"); resp = resp + "<oldef>";
resp = resp + overlayDefault;
resp = resp + "</oldef>";
resp = resp + "<woffs>";
resp = resp + abs(arlsOffset);
resp = resp + "</woffs>";
resp = resp + "<woffn>";
resp = resp + bool2int(!arlsSign);
resp = resp + "</woffn>";
resp = resp + "<noota>"; resp = resp + "<noota>";
resp = resp + bool2int(ota_lock); resp = resp + bool2int(ota_lock);
resp = resp +"</noota>"; resp = resp +"</noota>";

View File

@ -98,6 +98,12 @@ void handleSettingsSet()
if (i >= 0 && i <= 255) staticsubnet[3] = i; if (i >= 0 && i <= 255) staticsubnet[3] = i;
} }
if (server.hasArg("DESC")) serverDescription = server.arg("DESC"); if (server.hasArg("DESC")) serverDescription = server.arg("DESC");
if (server.hasArg("LEDCN"))
{
int i = server.arg("LEDCN").toInt();
if (i >= 0 && i <= 255) ledcount = i;
strip.setLedCount(ledcount);
}
if (server.hasArg("CBEOR")) if (server.hasArg("CBEOR"))
{ {
col_s[0] = col[0]; col_s[0] = col[0];
@ -174,7 +180,26 @@ void handleSettingsSet()
notifyDirect = server.hasArg("NSDIR"); notifyDirect = server.hasArg("NSDIR");
notifyButton = server.hasArg("NSBTN"); notifyButton = server.hasArg("NSBTN");
notifyNightlight = server.hasArg("NSFWD"); notifyNightlight = server.hasArg("NSFWD");
alexaEnabled = server.hasArg("ALEXA");
if (server.hasArg("AINVN")) alexaInvocationName = server.arg("AINVN");
alexaNotify = server.hasArg("NSALX");
ntpEnabled = server.hasArg("NTPON"); ntpEnabled = server.hasArg("NTPON");
if (server.hasArg("OLDEF"))
{
int i = server.arg("OLDEF").toInt();
if (i >= 0 && i <= 255) overlayDefault = i;
}
if (server.hasArg("WOFFS"))
{
int i = server.arg("WOFFS").toInt();
if (i >= 0 && i <= 255) arlsOffset = i;
arlsSign = true;
if (server.hasArg("WOFFN"))
{
arlsSign = false;
arlsOffset = -arlsOffset;
}
}
if (server.hasArg("OPASS")) if (server.hasArg("OPASS"))
{ {
if (!ota_lock) if (!ota_lock)

View File

@ -133,8 +133,11 @@ void wledInit()
MDNS.addService("http", "tcp", 80); MDNS.addService("http", "tcp", 80);
//Init alexa service //Init alexa service
alexaInit(); alexaInit();
overlayCurrent = overlayDefault;
// Initialize NeoPixel Strip // Initialize NeoPixel Strip
strip.init(); strip.init();
strip.setLedCount(ledcount);
strip.setMode(effectCurrent); strip.setMode(effectCurrent);
strip.setColor(0); strip.setColor(0);
strip.setSpeed(effectSpeed); strip.setSpeed(effectSpeed);

View File

@ -70,7 +70,7 @@ void handleNotifications()
arlsTimeout = false; arlsTimeout = false;
} else { } else {
if (!arlsTimeout){ if (!arlsTimeout){
strip.setRange(0, LEDCOUNT-1, 0); strip.setRange(0, ledcount-1, 0);
strip.setMode(0); strip.setMode(0);
} }
arlsTimeout = true; arlsTimeout = true;
@ -78,7 +78,7 @@ void handleNotifications()
} }
for (int i = 2; i < packetSize -3; i += 4) for (int i = 2; i < packetSize -3; i += 4)
{ {
if (udpIn[i] + arlsOffset < LEDCOUNT && udpIn[i] + arlsOffset >= 0) if (udpIn[i] + arlsOffset < ledcount && udpIn[i] + arlsOffset >= 0)
if (useGammaCorrectionRGB) if (useGammaCorrectionRGB)
{ {
strip.setIndividual(udpIn[i] + arlsOffset, ((uint32_t)gamma8[udpIn[i+1]] << 16) | ((uint32_t)gamma8[udpIn[i+2]] << 8) | gamma8[udpIn[i+3]]); strip.setIndividual(udpIn[i] + arlsOffset, ((uint32_t)gamma8[udpIn[i+1]] << 16) | ((uint32_t)gamma8[udpIn[i+2]] << 8) | gamma8[udpIn[i+3]]);