Fully implemented settings logic, not working

ESP.reset() crashes module
settings not getting saved
EEPROM saver?
EEPROM loader?
server args?
-> More printouts
TODO updated
This commit is contained in:
cschwinne 2016-09-12 22:40:46 +02:00
parent f13b377ca6
commit 57c42facd5
3 changed files with 13 additions and 13 deletions

View File

@ -1,13 +1,13 @@
switch dev enviroment to 100% git pc -- done switch dev enviroment to 100% git pc -- done
fix current issues -- done fix current issues -- vip -- debug
implement brightness slider -- vip -- done implement brightness slider -- vip -- done
remove settings lock option -- done remove settings lock option -- done
toolbar preparation toolbar preparation
add toolbar conf in settings add toolbar conf in settings
additional color picker field additional color picker field
change slider height to relative values change slider height to relative values
fully implement EEPROM -- vip -- done fully implement EEPROM -- vip -- done -- debug
implement settings getter/setter -- vip implement settings getter/setter -- vip -- done -- debug
implement OTA implement OTA
implement OTA lock implement OTA lock
implement button implement button
@ -17,5 +17,3 @@ implement default color on boot
FAILURE SOURCE?? --> non-null String FAILURE SOURCE?? --> non-null String
+4917693264270

View File

@ -63,7 +63,7 @@
</head> </head>
<body onload="GetCurrent()" class=" __plain_text_READY__"> <body onload="GetCurrent()" class=" __plain_text_READY__">
<h1>WLED Settings</h1> <h1>WLED Settings</h1>
<form id="form_s" name="Settings_form" action="set-settings/" method="post"> <form id="form_s" name="Settings_form" action="set-settings" method="post">
<input type="submit" name="SUBM" value="Save"> <input type="submit" name="SUBM" value="Save">
<input type="button" name="BACK" value="Back" onclick="OpenMain()"> <input type="button" name="BACK" value="Back" onclick="OpenMain()">
<h2>WiFi setup</h2> <h2>WiFi setup</h2>

View File

@ -309,9 +309,11 @@ uint8_t getNumberAfterStringPos(char str[], char spos)
return op.toInt(); return op.toInt();
} }
void handleSettingsSet(char HTTP_req[]) void handleSettingsSet()
{ {
if (server.hasArg("CSSID")) clientssid = server.arg("CSSID");
saveSettingsToEEPROM();
} }
boolean handleSet(String req) boolean handleSet(String req)
@ -320,11 +322,6 @@ boolean handleSet(String req)
Serial.println(req); Serial.println(req);
req.toCharArray(HTTP_req, 350, 0); req.toCharArray(HTTP_req, 350, 0);
if (!StrContains(HTTP_req, "ajax_in")) { if (!StrContains(HTTP_req, "ajax_in")) {
if (StrContains(HTTP_req, "set-settings"))
{
handleSettingsSet(HTTP_req);
return true;
}
if (StrContains(HTTP_req, "get-settings")) if (StrContains(HTTP_req, "get-settings"))
{ {
XML_response_settings(); XML_response_settings();
@ -555,6 +552,11 @@ void setup() {
if(!handleFileRead("/index.htm")) server.send(404, "text/plain", "FileNotFound"); if(!handleFileRead("/index.htm")) server.send(404, "text/plain", "FileNotFound");
}); });
server.on("/reset", HTTP_GET, reset); server.on("/reset", HTTP_GET, reset);
server.on("/set-settings", HTTP_POST, [](){
handleSettingsSet();
server.send(200, "text/plain", "Settings saved. Please wait a minute for module to reset...");
reset();
});
if (!ota_lock){ if (!ota_lock){
//load editor //load editor
server.on("/edit", HTTP_GET, [](){ server.on("/edit", HTTP_GET, [](){