diff --git a/TODO.txt b/TODO.txt
index ce068b64..4e9734bf 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -15,5 +15,6 @@ implement LED Control (NeoPixelBus?) -- vip
implement HSB slider option
implement default color on boot
-
+Bugs:
FAILURE SOURCE?? --> non-null String
+post req doesnt send checkboxes
diff --git a/wled00/data/settings.htm b/wled00/data/settings.htm
index 1e9a20bf..ba618ac1 100644
--- a/wled00/data/settings.htm
+++ b/wled00/data/settings.htm
@@ -13,34 +13,34 @@
if (this.readyState == 4) {
if (this.status == 200) {
if (this.responseXML != null) {
- document.Settings_form.CSSID.value = this.responseXML.getElementsByTagName('cssid')[0].childNodes[0].nodeValue;
- document.Settings_form.CPASS.value = this.responseXML.getElementsByTagName('cpass')[0].childNodes[0].nodeValue; //fake pass like ******
- document.Settings_form.CSIP0.value = this.responseXML.getElementsByTagName('csips')[0].childNodes[0].nodeValue;
- document.Settings_form.CSIP1.value = this.responseXML.getElementsByTagName('csips')[1].childNodes[0].nodeValue;
- document.Settings_form.CSIP2.value = this.responseXML.getElementsByTagName('csips')[2].childNodes[0].nodeValue;
- document.Settings_form.CSIP3.value = this.responseXML.getElementsByTagName('csips')[3].childNodes[0].nodeValue;
- document.Settings_form.CSGW0.value = this.responseXML.getElementsByTagName('csgws')[0].childNodes[0].nodeValue;
- document.Settings_form.CSGW1.value = this.responseXML.getElementsByTagName('csgws')[1].childNodes[0].nodeValue;
- document.Settings_form.CSGW2.value = this.responseXML.getElementsByTagName('csgws')[2].childNodes[0].nodeValue;
- document.Settings_form.CSGW3.value = this.responseXML.getElementsByTagName('csgws')[3].childNodes[0].nodeValue;
- document.Settings_form.CSSN0.value = this.responseXML.getElementsByTagName('cssns')[0].childNodes[0].nodeValue;
- document.Settings_form.CSSN1.value = this.responseXML.getElementsByTagName('cssns')[1].childNodes[0].nodeValue;
- document.Settings_form.CSSN2.value = this.responseXML.getElementsByTagName('cssns')[2].childNodes[0].nodeValue;
- document.Settings_form.CSSN3.value = this.responseXML.getElementsByTagName('cssns')[3].childNodes[0].nodeValue;
- document.Settings_form.CMDNS.value = this.responseXML.getElementsByTagName('cmdns')[0].childNodes[0].nodeValue;
- document.Settings_form.APSSID.value = this.responseXML.getElementsByTagName('apssid')[0].childNodes[0].nodeValue;
- document.Settings_form.APHSSID.checked = (this.responseXML.getElementsByTagName('aphssid')[0].childNodes[0].nodeValue)!=0?true:false;
- document.Settings_form.APPASS.value = this.responseXML.getElementsByTagName('appass')[0].childNodes[0].nodeValue; //fake pass like ******
- document.Settings_form.APCHAN.value = this.responseXML.getElementsByTagName('apchan')[0].childNodes[0].nodeValue;
- document.Settings_form.LEDS.value = this.responseXML.getElementsByTagName('leds')[0].childNodes[0].nodeValue;
- document.Settings_form.PWRLED.checked = (this.responseXML.getElementsByTagName('pwrled')[0].childNodes[0].nodeValue)!=0?true:false;
- document.Settings_form.BTNP.value = this.responseXML.getElementsByTagName('btnp')[0].childNodes[0].nodeValue;
- document.Settings_form.NOOTA.checked = (this.responseXML.getElementsByTagName('noota')[0].childNodes[0].nodeValue)!=0?true:false;
- document.Settings_form.NORAP.checked = (this.responseXML.getElementsByTagName('norap')[0].childNodes[0].nodeValue)!=0?true:false;
- document.getElementsByClassName("sip")[0].innerHTML = this.responseXML.getElementsByTagName('sip')[0].childNodes[0].nodeValue;
- document.getElementsByClassName("sip")[1].innerHTML = this.responseXML.getElementsByTagName('sip')[1].childNodes[0].nodeValue;
- document.getElementsByClassName("otastat")[0].innerHTML = this.responseXML.getElementsByTagName('otastat')[0].childNodes[0].nodeValue;
- document.getElementsByClassName("msg")[0].innerHTML = this.responseXML.getElementsByTagName('msg')[0].childNodes[0].nodeValue;
+ document.Settings_form.CSSID.value = this.responseXML.getElementsByTagName('cssid')[0].innerHTML;
+ document.Settings_form.CPASS.value = this.responseXML.getElementsByTagName('cpass')[0].innerHTML; //fake pass like ******
+ document.Settings_form.CSIP0.value = this.responseXML.getElementsByTagName('csips')[0].innerHTML;
+ document.Settings_form.CSIP1.value = this.responseXML.getElementsByTagName('csips')[1].innerHTML;
+ document.Settings_form.CSIP2.value = this.responseXML.getElementsByTagName('csips')[2].innerHTML;
+ document.Settings_form.CSIP3.value = this.responseXML.getElementsByTagName('csips')[3].innerHTML;
+ document.Settings_form.CSGW0.value = this.responseXML.getElementsByTagName('csgws')[0].innerHTML;
+ document.Settings_form.CSGW1.value = this.responseXML.getElementsByTagName('csgws')[1].innerHTML;
+ document.Settings_form.CSGW2.value = this.responseXML.getElementsByTagName('csgws')[2].innerHTML;
+ document.Settings_form.CSGW3.value = this.responseXML.getElementsByTagName('csgws')[3].innerHTML;
+ document.Settings_form.CSSN0.value = this.responseXML.getElementsByTagName('cssns')[0].innerHTML;
+ document.Settings_form.CSSN1.value = this.responseXML.getElementsByTagName('cssns')[1].innerHTML;
+ document.Settings_form.CSSN2.value = this.responseXML.getElementsByTagName('cssns')[2].innerHTML;
+ document.Settings_form.CSSN3.value = this.responseXML.getElementsByTagName('cssns')[3].innerHTML;
+ document.Settings_form.CMDNS.value = this.responseXML.getElementsByTagName('cmdns')[0].innerHTML;
+ document.Settings_form.APSSID.value = this.responseXML.getElementsByTagName('apssid')[0].innerHTML;
+ document.Settings_form.APHSSID.checked = (this.responseXML.getElementsByTagName('aphssid')[0].innerHTML)!=0?true:false;
+ document.Settings_form.APPASS.value = this.responseXML.getElementsByTagName('appass')[0].innerHTML; //fake pass like ******
+ document.Settings_form.APCHAN.value = this.responseXML.getElementsByTagName('apchan')[0].innerHTML;
+ document.Settings_form.LEDS.value = this.responseXML.getElementsByTagName('leds')[0].innerHTML;
+ document.Settings_form.PWRLED.checked = (this.responseXML.getElementsByTagName('pwrled')[0].innerHTML)!=0?true:false;
+ document.Settings_form.BTNP.value = this.responseXML.getElementsByTagName('btnp')[0].innerHTML;
+ document.Settings_form.NOOTA.checked = (this.responseXML.getElementsByTagName('noota')[0].innerHTML)!=0?true:false;
+ document.Settings_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")[1].innerHTML = this.responseXML.getElementsByTagName('sip')[1].innerHTML;
+ document.getElementsByClassName("otastat")[0].innerHTML = this.responseXML.getElementsByTagName('otastat')[0].innerHTML;
+ document.getElementsByClassName("msg")[0].innerHTML = this.responseXML.getElementsByTagName('msg')[0].innerHTML;
if (Settings_form.NOOTA.checked) {document.Settings_form.NOOTA.disabled="disabled";}
}
}
diff --git a/wled00/wled00.ino b/wled00/wled00.ino
index 0ef5bbfc..82167ce2 100644
--- a/wled00/wled00.ino
+++ b/wled00/wled00.ino
@@ -30,7 +30,7 @@ boolean ota_lock = false;
int led_amount = 16;
int nopwrled = 1;
-char HTTP_req[350];
+char HTTP_req[150];
ESP8266WebServer server(80);
File fsUploadFile;
@@ -53,12 +53,14 @@ void clearEEPROM()
{
EEPROM.write(i, 0);
}
+ EEPROM.commit();
}
void saveSettingsToEEPROM()
{
if (EEPROM.read(233) != 233) //set no first boot flag
{
+ clearEEPROM();
EEPROM.write(233, 233);
}
for (int i = 0; i < 32; ++i)
@@ -67,19 +69,19 @@ void saveSettingsToEEPROM()
}
for (int i = 32; i < 96; ++i)
{
- EEPROM.write(i, clientpass.charAt(i));
+ EEPROM.write(i, clientpass.charAt(i-32));
}
for (int i = 96; i < 128; ++i)
{
- EEPROM.write(i, cmdns.charAt(i));
+ EEPROM.write(i, cmdns.charAt(i-96));
}
for (int i = 128; i < 160; ++i)
{
- EEPROM.write(i, apssid.charAt(i));
+ EEPROM.write(i, apssid.charAt(i-128));
}
for (int i = 160; i < 224; ++i)
{
- EEPROM.write(i, appass.charAt(i));
+ EEPROM.write(i, appass.charAt(i-160));
}
EEPROM.write(228, aphide);
EEPROM.write(227, apchannel);
@@ -97,6 +99,8 @@ void saveSettingsToEEPROM()
EEPROM.write(243, staticsubnet[1]);
EEPROM.write(244, staticsubnet[2]);
EEPROM.write(245, staticsubnet[3]);
+
+ EEPROM.commit();
}
void loadSettingsFromEEPROM()
@@ -109,27 +113,32 @@ void loadSettingsFromEEPROM()
clientssid = "";
for (int i = 0; i < 32; ++i)
{
- clientssid += char(EEPROM.read(i));
+ if (EEPROM.read(i) == 0) break;
+ clientssid += char(EEPROM.read(i));
}
clientpass = "";
for (int i = 32; i < 96; ++i)
{
- clientpass += char(EEPROM.read(i));
+ if (EEPROM.read(i) == 0) break;
+ clientpass += char(EEPROM.read(i));
}
cmdns = "";
for (int i = 96; i < 128; ++i)
{
- cmdns += char(EEPROM.read(i));
+ if (EEPROM.read(i) == 0) break;
+ cmdns += char(EEPROM.read(i));
}
apssid = "";
for (int i = 128; i < 160; ++i)
{
- apssid += char(EEPROM.read(i));
+ if (EEPROM.read(i) == 0) break;
+ apssid += char(EEPROM.read(i));
}
appass = "";
for (int i = 160; i < 224; ++i)
{
- appass += char(EEPROM.read(i));
+ if (EEPROM.read(i) == 0) break;
+ appass += char(EEPROM.read(i));
}
aphide = EEPROM.read(228);
if (aphide > 1) aphide = 1;
@@ -174,6 +183,7 @@ void XML_response()
void XML_response_settings()
{
+ Serial.println("XML settings response");
String resp;
resp = resp + "";
resp = resp + "