From 57c42facd51f2b3d2819ef35165574de8b2dfe8d Mon Sep 17 00:00:00 2001 From: cschwinne Date: Mon, 12 Sep 2016 22:40:46 +0200 Subject: [PATCH] Fully implemented settings logic, not working ESP.reset() crashes module settings not getting saved EEPROM saver? EEPROM loader? server args? -> More printouts TODO updated --- TODO.txt | 8 +++----- wled00/data/settings.htm | 2 +- wled00/wled00.ino | 16 +++++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/TODO.txt b/TODO.txt index 0eb1c3f9..ce068b64 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,13 +1,13 @@ switch dev enviroment to 100% git pc -- done -fix current issues -- done +fix current issues -- vip -- debug implement brightness slider -- vip -- done remove settings lock option -- done toolbar preparation add toolbar conf in settings additional color picker field change slider height to relative values -fully implement EEPROM -- vip -- done -implement settings getter/setter -- vip +fully implement EEPROM -- vip -- done -- debug +implement settings getter/setter -- vip -- done -- debug implement OTA implement OTA lock implement button @@ -17,5 +17,3 @@ implement default color on boot FAILURE SOURCE?? --> non-null String - -+4917693264270 \ No newline at end of file diff --git a/wled00/data/settings.htm b/wled00/data/settings.htm index fd5881a4..1e9a20bf 100644 --- a/wled00/data/settings.htm +++ b/wled00/data/settings.htm @@ -63,7 +63,7 @@

WLED Settings

-
+

WiFi setup

diff --git a/wled00/wled00.ino b/wled00/wled00.ino index 9b9b60ef..0ef5bbfc 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -309,9 +309,11 @@ uint8_t getNumberAfterStringPos(char str[], char spos) return op.toInt(); } -void handleSettingsSet(char HTTP_req[]) +void handleSettingsSet() { - + if (server.hasArg("CSSID")) clientssid = server.arg("CSSID"); + + saveSettingsToEEPROM(); } boolean handleSet(String req) @@ -320,11 +322,6 @@ boolean handleSet(String req) Serial.println(req); req.toCharArray(HTTP_req, 350, 0); if (!StrContains(HTTP_req, "ajax_in")) { - if (StrContains(HTTP_req, "set-settings")) - { - handleSettingsSet(HTTP_req); - return true; - } if (StrContains(HTTP_req, "get-settings")) { XML_response_settings(); @@ -555,6 +552,11 @@ void setup() { if(!handleFileRead("/index.htm")) server.send(404, "text/plain", "FileNotFound"); }); 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){ //load editor server.on("/edit", HTTP_GET, [](){