From f13b377ca6a5f26e713adbe4629da972813eee35 Mon Sep 17 00:00:00 2001 From: cschwinne Date: Mon, 12 Sep 2016 22:05:52 +0200 Subject: [PATCH] Settings getter working --- wled00/data/settings.htm | 2 +- wled00/wled00.ino | 44 +++++++++++++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/wled00/data/settings.htm b/wled00/data/settings.htm index cc8abd37f..fd5881a45 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 59ce9db48..9b9b60ef0 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[150]; +char HTTP_req[350]; ESP8266WebServer server(80); File fsUploadFile; @@ -176,6 +176,7 @@ void XML_response_settings() { String resp; resp = resp + ""; + resp = resp + ""; resp = resp + ""; resp = resp + clientssid; resp = resp + ""; @@ -231,23 +232,38 @@ void XML_response_settings() resp = resp + "0"; //NI resp = resp + "0"; //NI resp = resp + ""; - if (!Wifi.localIP()[0] == 0) + if (!WiFi.localIP()[0] == 0) { - resp = resp + WiFi.localIP(); + resp = resp + WiFi.localIP()[0]; + resp = resp + "."; + resp = resp + WiFi.localIP()[1]; + resp = resp + "."; + resp = resp + WiFi.localIP()[2]; + resp = resp + "."; + resp = resp + WiFi.localIP()[3]; } else { resp = resp + "Not connected"; } resp = resp + ""; resp = resp + ""; - if (!Wifi.softAPIP()[0] == 0) + if (!WiFi.softAPIP()[0] == 0) { - resp = resp + WiFi.softAPIP(); + resp = resp + WiFi.softAPIP()[0]; + resp = resp + "."; + resp = resp + WiFi.softAPIP()[1]; + resp = resp + "."; + resp = resp + WiFi.softAPIP()[2]; + resp = resp + "."; + resp = resp + WiFi.softAPIP()[3]; } else { resp = resp + "Not active"; } resp = resp + ""; + resp = resp + "Not implemented"; + resp = resp + "WLED 0.1c OK"; + resp = resp + ""; server.send(200, "text/xml", resp); } @@ -293,13 +309,27 @@ uint8_t getNumberAfterStringPos(char str[], char spos) return op.toInt(); } +void handleSettingsSet(char HTTP_req[]) +{ + +} + boolean handleSet(String req) { Serial.println("handleSet:"); Serial.println(req); - req.toCharArray(HTTP_req, 150, 0); + req.toCharArray(HTTP_req, 350, 0); if (!StrContains(HTTP_req, "ajax_in")) { - if ( + if (StrContains(HTTP_req, "set-settings")) + { + handleSettingsSet(HTTP_req); + return true; + } + if (StrContains(HTTP_req, "get-settings")) + { + XML_response_settings(); + return true; + } return false; } int pos = 0;