From a863167b23728903f0c4d8d82972d457a52b902a Mon Sep 17 00:00:00 2001 From: Jasper Date: Tue, 13 Feb 2018 11:16:37 +0800 Subject: [PATCH 01/11] Lower RAM usage of library Place remaining debug messages into Flash using F(). --- WiFiManager.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 7e9a9d9..8b1e68e 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -92,14 +92,14 @@ bool WiFiManager::addParameter(WiFiManagerParameter *p) { if (new_params != NULL) { _params = new_params; } else { - DEBUG_WM("ERROR: failed to realloc params, size not increased!"); + DEBUG_WM(F("ERROR: failed to realloc params, size not increased!")); return false; } } _params[_paramsCount] = p; _paramsCount++; - DEBUG_WM("Adding parameter"); + DEBUG_WM(F("Adding parameter")); DEBUG_WM(p->getID()); return true; } @@ -199,7 +199,7 @@ boolean WiFiManager::startConfigPortal() { boolean WiFiManager::startConfigPortal(char const *apName, char const *apPassword) { //setup AP WiFi.mode(WIFI_AP_STA); - DEBUG_WM("SET AP STA"); + DEBUG_WM(F("SET AP STA")); _apName = apName; _apPassword = apPassword; @@ -273,7 +273,7 @@ int WiFiManager::connectWifi(String ssid, String pass) { } //fix for auto connect racing issue if (WiFi.status() == WL_CONNECTED) { - DEBUG_WM("Already connected. Bailing out."); + DEBUG_WM(F("Already connected. Bailing out.")); return WL_CONNECTED; } //check if we have ssid and pass and force those, if not, try with last saved values @@ -281,7 +281,7 @@ int WiFiManager::connectWifi(String ssid, String pass) { WiFi.begin(ssid.c_str(), pass.c_str()); } else { if (WiFi.SSID()) { - DEBUG_WM("Using last saved values, should be faster"); + DEBUG_WM(F("Using last saved values, should be faster")); //trying to fix connection in progress hanging ETS_UART_INTR_DISABLE(); wifi_station_disconnect(); @@ -289,7 +289,7 @@ int WiFiManager::connectWifi(String ssid, String pass) { WiFi.begin(); } else { - DEBUG_WM("No saved credentials"); + DEBUG_WM(F("No saved credentials")); } } @@ -329,9 +329,9 @@ uint8_t WiFiManager::waitForConnectResult() { } void WiFiManager::startWPS() { - DEBUG_WM("START WPS"); + DEBUG_WM(F("START WPS")); WiFi.beginWPSConfig(); - DEBUG_WM("END WPS"); + DEBUG_WM(F("END WPS")); } /* String WiFiManager::getSSID() { @@ -764,7 +764,7 @@ void WiFiManager::setRemoveDuplicateAPs(boolean removeDuplicates) { template void WiFiManager::DEBUG_WM(Generic text) { if (_debug) { - Serial.print("*WM: "); + Serial.print(F("*WM: ")); Serial.println(text); } } From aa734eb606319b8456d9767272ed6e3f58da5a6e Mon Sep 17 00:00:00 2001 From: Jasper Date: Tue, 13 Feb 2018 17:18:26 +0800 Subject: [PATCH 02/11] Update WiFiManager.cpp --- WiFiManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 8b1e68e..79b7780 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -764,7 +764,7 @@ void WiFiManager::setRemoveDuplicateAPs(boolean removeDuplicates) { template void WiFiManager::DEBUG_WM(Generic text) { if (_debug) { - Serial.print(F("*WM: ")); + Serial.print("*WM: "); Serial.println(text); } } From a94d897ee447348c907a3d87551c2ccad7abd31c Mon Sep 17 00:00:00 2001 From: Jasper Date: Tue, 13 Feb 2018 19:52:38 +0800 Subject: [PATCH 03/11] Update WiFiManager.cpp --- WiFiManager.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 79b7780..d177fac 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -143,14 +143,14 @@ void WiFiManager::setupConfigPortal() { dnsServer->start(DNS_PORT, "*", WiFi.softAPIP()); /* Setup web pages: root, wifi config pages, SO captive portal detectors and not found. */ - server->on("/", std::bind(&WiFiManager::handleRoot, this)); - server->on("/wifi", std::bind(&WiFiManager::handleWifi, this, true)); - server->on("/0wifi", std::bind(&WiFiManager::handleWifi, this, false)); - server->on("/wifisave", std::bind(&WiFiManager::handleWifiSave, this)); - server->on("/i", std::bind(&WiFiManager::handleInfo, this)); - server->on("/r", std::bind(&WiFiManager::handleReset, this)); + server->on(String(F("/")), std::bind(&WiFiManager::handleRoot, this)); + server->on(String(F("/wifi")), std::bind(&WiFiManager::handleWifi, this, true)); + server->on(String(F("/0wifi")), std::bind(&WiFiManager::handleWifi, this, false)); + server->on(String(F("/wifisave")), std::bind(&WiFiManager::handleWifiSave, this)); + server->on(String(F("/i")), std::bind(&WiFiManager::handleInfo, this)); + server->on(String(F("/r")), std::bind(&WiFiManager::handleReset, this)); //server->on("/generate_204", std::bind(&WiFiManager::handle204, this)); //Android/Chrome OS captive portal check. - server->on("/fwlink", std::bind(&WiFiManager::handleRoot, this)); //Microsoft captive portal. Maybe not needed. Might be handled by notFound handler. + server->on(String(F("/fwlink")), std::bind(&WiFiManager::handleRoot, this)); //Microsoft captive portal. Maybe not needed. Might be handled by notFound handler. server->onNotFound (std::bind(&WiFiManager::handleNotFound, this)); server->begin(); // Web server start DEBUG_WM(F("HTTP server started")); @@ -413,10 +413,10 @@ void WiFiManager::handleRoot() { page += FPSTR(HTTP_STYLE); page += _customHeadElement; page += FPSTR(HTTP_HEAD_END); - page += "

"; + page += String(F("

")); page += _apName; - page += "

"; - page += F("

WiFiManager

"); + page += String(F("")); + page += Strint(F("

WiFiManager

")); page += FPSTR(HTTP_PORTAL_OPTIONS); page += FPSTR(HTTP_END); From 5243036dbf1817b20238fa4f01474d1474e27a9a Mon Sep 17 00:00:00 2001 From: Jasper Date: Tue, 13 Feb 2018 20:00:17 +0800 Subject: [PATCH 04/11] Update WiFiManager.cpp --- WiFiManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index d177fac..527c69e 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -416,7 +416,7 @@ void WiFiManager::handleRoot() { page += String(F("

")); page += _apName; page += String(F("

")); - page += Strint(F("

WiFiManager

")); + page += String(F("

WiFiManager

")); page += FPSTR(HTTP_PORTAL_OPTIONS); page += FPSTR(HTTP_END); From 1c890c0c49f19449f66d8ac23a0193d213c243b3 Mon Sep 17 00:00:00 2001 From: Shawn A Date: Tue, 13 Feb 2018 07:40:55 -0600 Subject: [PATCH 05/11] Create contributing.md --- .github/contributing.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github/contributing.md diff --git a/.github/contributing.md b/.github/contributing.md new file mode 100644 index 0000000..a7dbf8b --- /dev/null +++ b/.github/contributing.md @@ -0,0 +1,9 @@ +## Contributing PRs and ISSUES + +The development branch is the active branch, no features or bugs will be fixed against master ( hotfixes may be considered ). + +Please test against development branch before submitting issues, issues against master will be closed, + +PRs against master may be kept open if provides something useful to other members. + +Please open issues before sumbitting PRs against development, as commits might be occuring very frequently. From 7f2fdee9c873beba918a11e5aec7bca2fdae7f5b Mon Sep 17 00:00:00 2001 From: Shawn A Date: Tue, 13 Feb 2018 07:42:23 -0600 Subject: [PATCH 06/11] Create ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..2c57263 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,53 @@ + +Please fill the info fields, it helps to get you faster support ;) + +if you have a stack dump decode it: +https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.rst + +for better debug messages: +https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.rst + +----------------------------- Remove above ----------------------------- + +### Basic Infos + +#### Hardware +Hardware: ?ESP-12? +Core Version: ?2.1.0-rc2? + +### Description + +Problem description + +### Settings in IDE + +Module: ?Generic ESP8266 Module? +Flash Size: ?4MB/1MB? +CPU Frequency: ?80Mhz? +Flash Mode: ?qio? +Flash Frequency: ?40Mhz? +Upload Using: ?OTA / SERIAL? +Reset Method: ?ck / nodemcu? + + +### Sketch + +```cpp + +#include + +void setup() { + +} + +void loop() { + +} +``` + +### Debug Messages + +``` +messages here +``` + From 3dcf3c0927cc2c2588b48150892fc42465209b53 Mon Sep 17 00:00:00 2001 From: Shawn A Date: Tue, 13 Feb 2018 07:55:32 -0600 Subject: [PATCH 07/11] rename --- .github/contributing.md | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 .github/contributing.md diff --git a/.github/contributing.md b/.github/contributing.md deleted file mode 100644 index a7dbf8b..0000000 --- a/.github/contributing.md +++ /dev/null @@ -1,9 +0,0 @@ -## Contributing PRs and ISSUES - -The development branch is the active branch, no features or bugs will be fixed against master ( hotfixes may be considered ). - -Please test against development branch before submitting issues, issues against master will be closed, - -PRs against master may be kept open if provides something useful to other members. - -Please open issues before sumbitting PRs against development, as commits might be occuring very frequently. From 611246bd75677993d6c86b94e42630c325da063d Mon Sep 17 00:00:00 2001 From: Shawn A Date: Tue, 13 Feb 2018 07:55:41 -0600 Subject: [PATCH 08/11] rename --- .github/CONTRIBUTING.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github/CONTRIBUTING.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..a7dbf8b --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,9 @@ +## Contributing PRs and ISSUES + +The development branch is the active branch, no features or bugs will be fixed against master ( hotfixes may be considered ). + +Please test against development branch before submitting issues, issues against master will be closed, + +PRs against master may be kept open if provides something useful to other members. + +Please open issues before sumbitting PRs against development, as commits might be occuring very frequently. From e9cf051cb20134fa828696a98218a398b21c269d Mon Sep 17 00:00:00 2001 From: Shawn A Date: Thu, 15 Feb 2018 09:03:50 -0600 Subject: [PATCH 09/11] Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 2c57263..adcb26e 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -12,8 +12,9 @@ https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.rst ### Basic Infos #### Hardware -Hardware: ?ESP-12? -Core Version: ?2.1.0-rc2? +WiFimanager Branch/Release: Development +Hardware: ESP-12e, wemos, esp01 +Core Version: 2.4.0, staging ### Description @@ -21,14 +22,8 @@ Problem description ### Settings in IDE -Module: ?Generic ESP8266 Module? -Flash Size: ?4MB/1MB? -CPU Frequency: ?80Mhz? -Flash Mode: ?qio? -Flash Frequency: ?40Mhz? -Upload Using: ?OTA / SERIAL? -Reset Method: ?ck / nodemcu? - +Module: NodeMcu, Wemos D1 +Additional libraries: ### Sketch From d86351dff4b430c5c5c7c71e758d2713ec2f6c5b Mon Sep 17 00:00:00 2001 From: Shawn A Date: Thu, 15 Feb 2018 09:04:21 -0600 Subject: [PATCH 10/11] Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index adcb26e..5700570 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -13,7 +13,9 @@ https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.rst #### Hardware WiFimanager Branch/Release: Development -Hardware: ESP-12e, wemos, esp01 + +Hardware: ESP-12e, esp01, esp25 + Core Version: 2.4.0, staging ### Description @@ -23,6 +25,7 @@ Problem description ### Settings in IDE Module: NodeMcu, Wemos D1 + Additional libraries: ### Sketch From f333f271e405a16800f166f9501653b912c7163a Mon Sep 17 00:00:00 2001 From: David Gauchard Date: Wed, 21 Feb 2018 12:10:19 +0100 Subject: [PATCH 11/11] remove warning --- WiFiManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 527c69e..1e6d805 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -784,7 +784,7 @@ int WiFiManager::getRSSIasQuality(int RSSI) { /** Is this an IP? */ boolean WiFiManager::isIp(String str) { - for (int i = 0; i < str.length(); i++) { + for (size_t i = 0; i < str.length(); i++) { int c = str.charAt(i); if (c != '.' && (c < '0' || c > '9')) { return false;