From 362a561a35960ea8ae8a67f2ab2daa5af2f242df Mon Sep 17 00:00:00 2001 From: Chris Liebman Date: Sun, 4 Jun 2017 06:41:27 -0700 Subject: [PATCH 01/36] use malloc/free for WiFiManagerParameter* array instead of hard coding. add alternate constructor to specifiy max parameter count origional default constructor uses old hard codded value --- README.md | 5 +++++ WiFiManager.cpp | 27 +++++++++++++++++++++++++-- WiFiManager.h | 6 +++++- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a329f2b..3e83d4b 100644 --- a/README.md +++ b/README.md @@ -204,6 +204,11 @@ You should also take a look at adding custom HTML to your form. - Save and load custom parameters to file system in json form [AutoConnectWithFSParameters](https://github.com/tzapu/WiFiManager/tree/master/examples/AutoConnectWithFSParameters) - *Save and load custom parameters to EEPROM* (not done yet) +NOTE: if your need more than 10 (the default) custom parameters you will need to use the alternate constructor: +```cpp +WiFiManager wifiManager(15); // pass the number of params you will be adding +``` + #### Custom IP Configuration You can set a custom IP for both AP (access point, config mode) and STA (station mode, client mode, normal project state) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 4fba355..4be0105 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -60,14 +60,37 @@ const char* WiFiManagerParameter::getCustomHTML() { return _customHTML; } + WiFiManager::WiFiManager() { + init(WIFI_MANAGER_MAX_PARAMS); +} + +WiFiManager::WiFiManager(int max_params) { + init(max_params); +} + +void WiFiManager::init(int max_params) +{ + DEBUG_WM(F("setting max_params to:")); + DEBUG_WM(max_params); + _max_params = max_params; + _params = (WiFiManagerParameter**)malloc(_max_params * sizeof(WiFiManagerParameter*)); +} + +WiFiManager::~WiFiManager() +{ + if (_params != NULL) + { + DEBUG_WM(F("freeing allocated params!")); + free(_params); + } } void WiFiManager::addParameter(WiFiManagerParameter *p) { - if(_paramsCount + 1 > WIFI_MANAGER_MAX_PARAMS) + if(_paramsCount + 1 > _max_params) { //Max parameters exceeded! - DEBUG_WM("WIFI_MANAGER_MAX_PARAMS exceeded, increase number (in WiFiManager.h) before adding more parameters!"); + DEBUG_WM("max_params value exceeded, use WiFiManager(int max_params) constructor with a larger value!"); DEBUG_WM("Skipping parameter with ID:"); DEBUG_WM(p->getID()); return; diff --git a/WiFiManager.h b/WiFiManager.h index d86b904..2c8dece 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -65,6 +65,8 @@ class WiFiManager { public: WiFiManager(); + WiFiManager(int max_params); + ~WiFiManager(); boolean autoConnect(); boolean autoConnect(char const *apName, char const *apPassword = NULL); @@ -119,6 +121,7 @@ class WiFiManager //const String HTTP_HEAD = "{v}"; + void init(int max_params); void setupConfigPortal(); void startWPS(); @@ -176,7 +179,8 @@ class WiFiManager void (*_apcallback)(WiFiManager*) = NULL; void (*_savecallback)(void) = NULL; - WiFiManagerParameter* _params[WIFI_MANAGER_MAX_PARAMS]; + int _max_params; + WiFiManagerParameter** _params; template void DEBUG_WM(Generic text); From 3950a3b859f9a3c85dbcce21165f71ff1ff2b6c5 Mon Sep 17 00:00:00 2001 From: Chris Liebman Date: Tue, 27 Jun 2017 16:24:23 -0700 Subject: [PATCH 02/36] use single constructor with default value for size --- WiFiManager.cpp | 4 ---- WiFiManager.h | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 4be0105..081c714 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -61,10 +61,6 @@ const char* WiFiManagerParameter::getCustomHTML() { } -WiFiManager::WiFiManager() { - init(WIFI_MANAGER_MAX_PARAMS); -} - WiFiManager::WiFiManager(int max_params) { init(max_params); } diff --git a/WiFiManager.h b/WiFiManager.h index 2c8dece..ee1521e 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -65,7 +65,7 @@ class WiFiManager { public: WiFiManager(); - WiFiManager(int max_params); + WiFiManager(int max_params=10); ~WiFiManager(); boolean autoConnect(); From c4905c23b789df4f687d18923ebcd0855ded7968 Mon Sep 17 00:00:00 2001 From: Chris Liebman Date: Tue, 27 Jun 2017 16:27:37 -0700 Subject: [PATCH 03/36] remove init function as its not needed with one constructor --- WiFiManager.cpp | 5 ----- WiFiManager.h | 1 - 2 files changed, 6 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 081c714..a24cbca 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -62,11 +62,6 @@ const char* WiFiManagerParameter::getCustomHTML() { WiFiManager::WiFiManager(int max_params) { - init(max_params); -} - -void WiFiManager::init(int max_params) -{ DEBUG_WM(F("setting max_params to:")); DEBUG_WM(max_params); _max_params = max_params; diff --git a/WiFiManager.h b/WiFiManager.h index ee1521e..6b59ecd 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -121,7 +121,6 @@ class WiFiManager //const String HTTP_HEAD = "{v}"; - void init(int max_params); void setupConfigPortal(); void startWPS(); From 898768092cab07c748c70b00dbbb6a627e50a00a Mon Sep 17 00:00:00 2001 From: Chris Liebman Date: Tue, 27 Jun 2017 16:35:48 -0700 Subject: [PATCH 04/36] removed un-needed constructor declaration --- WiFiManager.h | 1 - 1 file changed, 1 deletion(-) diff --git a/WiFiManager.h b/WiFiManager.h index 6b59ecd..5b7893c 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -64,7 +64,6 @@ class WiFiManagerParameter { class WiFiManager { public: - WiFiManager(); WiFiManager(int max_params=10); ~WiFiManager(); From 6465d72f6e76cea610496240c682bdbce30b0ea3 Mon Sep 17 00:00:00 2001 From: Chris Liebman Date: Thu, 26 Oct 2017 15:23:47 -0700 Subject: [PATCH 05/36] Refactored to use only a default constructor and automatically resize the parameter array each time the size limit is reached. I used the initial size (WIFI_MANAGER_MAX_PARAMS) as the increment when resizing. Existing data is coppied to the new array and the old one is free'd. --- WiFiManager.cpp | 21 ++++++++++++--------- WiFiManager.h | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 16d9f5f..cf5d801 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -61,10 +61,8 @@ const char* WiFiManagerParameter::getCustomHTML() { } -WiFiManager::WiFiManager(int max_params) { - DEBUG_WM(F("setting max_params to:")); - DEBUG_WM(max_params); - _max_params = max_params; +WiFiManager::WiFiManager() { + _max_params = WIFI_MANAGER_MAX_PARAMS; _params = (WiFiManagerParameter**)malloc(_max_params * sizeof(WiFiManagerParameter*)); } @@ -80,12 +78,17 @@ WiFiManager::~WiFiManager() void WiFiManager::addParameter(WiFiManagerParameter *p) { if(_paramsCount + 1 > _max_params) { - //Max parameters exceeded! - DEBUG_WM("max_params value exceeded, use WiFiManager(int max_params) constructor with a larger value!"); - DEBUG_WM("Skipping parameter with ID:"); - DEBUG_WM(p->getID()); - return; + // rezise the params array + _max_params += WIFI_MANAGER_MAX_PARAMS; + DEBUG_WM(F("Increasing _max_params to:")); + DEBUG_WM(_max_params); + WiFiManagerParameter** new_params = (WiFiManagerParameter**)malloc(_max_params * sizeof(WiFiManagerParameter*)); + // copy old data + memcpy(new_params, _params, _paramsCount * sizeof(WiFiManagerParameter*)); + free(_params); + _params = new_params; } + _params[_paramsCount] = p; _paramsCount++; DEBUG_WM("Adding parameter"); diff --git a/WiFiManager.h b/WiFiManager.h index 364b7b7..f95ce1b 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -64,7 +64,7 @@ class WiFiManagerParameter { class WiFiManager { public: - WiFiManager(int max_params=10); + WiFiManager(); ~WiFiManager(); boolean autoConnect(); From 0b6341bea431767d95008f9a36c9b5d5c538ff08 Mon Sep 17 00:00:00 2001 From: Chris Liebman Date: Thu, 26 Oct 2017 16:10:34 -0700 Subject: [PATCH 06/36] cleanup readme (removed hint about alternate constructor) --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index 3f8996f..10da7f6 100644 --- a/README.md +++ b/README.md @@ -207,11 +207,6 @@ You should also take a look at adding custom HTML to your form. - Save and load custom parameters to file system in json form [AutoConnectWithFSParameters](https://github.com/tzapu/WiFiManager/tree/master/examples/AutoConnectWithFSParameters) - *Save and load custom parameters to EEPROM* (not done yet) -NOTE: if your need more than 10 (the default) custom parameters you will need to use the alternate constructor: -```cpp -WiFiManager wifiManager(15); // pass the number of params you will be adding -``` - #### Custom IP Configuration You can set a custom IP for both AP (access point, config mode) and STA (station mode, client mode, normal project state) From eb560629d6c22f8e77a2b6aed94a9143d596447f Mon Sep 17 00:00:00 2001 From: Luke Palmer Date: Mon, 4 Dec 2017 19:54:59 -0500 Subject: [PATCH 07/36] Document parameters --- WiFiManager.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/WiFiManager.h b/WiFiManager.h index 5b37e44..6c46b1e 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -39,6 +39,10 @@ const char HTTP_END[] PROGMEM = ""; class WiFiManagerParameter { public: + /** + Create custom parameters that can be added to the WiFiManager setup web page + @id is used for HTTP queries and must not contain spaces nor other special characters + */ WiFiManagerParameter(const char *custom); WiFiManagerParameter(const char *id, const char *placeholder, const char *defaultValue, int length); WiFiManagerParameter(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom); From d66cd47df87f2b478e7f7568b7c8e141c02dd53a Mon Sep 17 00:00:00 2001 From: Christopher Liebman Date: Sat, 9 Dec 2017 06:04:07 -0800 Subject: [PATCH 08/36] use realloc() when increasing the size of _params. addParameter() now returns bool indicating the status of adding the parameter where false indicates it failed to increase the size of _params and did not add the parameter. --- WiFiManager.cpp | 15 +++++++++------ WiFiManager.h | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index cf5d801..a82480a 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -75,24 +75,27 @@ WiFiManager::~WiFiManager() } } -void WiFiManager::addParameter(WiFiManagerParameter *p) { +bool WiFiManager::addParameter(WiFiManagerParameter *p) { if(_paramsCount + 1 > _max_params) { // rezise the params array _max_params += WIFI_MANAGER_MAX_PARAMS; DEBUG_WM(F("Increasing _max_params to:")); DEBUG_WM(_max_params); - WiFiManagerParameter** new_params = (WiFiManagerParameter**)malloc(_max_params * sizeof(WiFiManagerParameter*)); - // copy old data - memcpy(new_params, _params, _paramsCount * sizeof(WiFiManagerParameter*)); - free(_params); - _params = new_params; + WiFiManagerParameter** new_params = (WiFiManagerParameter**)realloc(_params, _max_params * sizeof(WiFiManagerParameter*)); + if (new_params != NULL) { + _params = new_params; + } else { + DEBUG_WM("ERROR: failed to realloc params, size not increased!"); + return false; + } } _params[_paramsCount] = p; _paramsCount++; DEBUG_WM("Adding parameter"); DEBUG_WM(p->getID()); + return true; } void WiFiManager::setupConfigPortal() { diff --git a/WiFiManager.h b/WiFiManager.h index f95ce1b..9a22573 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -100,8 +100,8 @@ class WiFiManager void setAPCallback( void (*func)(WiFiManager*) ); //called when settings have been changed and connection was successful void setSaveConfigCallback( void (*func)(void) ); - //adds a custom parameter - void addParameter(WiFiManagerParameter *p); + //adds a custom parameter, returns false on failure + bool addParameter(WiFiManagerParameter *p); //if this is set, it will exit after config, even if connection is unsuccessful. void setBreakAfterConfig(boolean shouldBreak); //if this is set, try WPS setup when starting (this will delay config portal for up to 2 mins) From a5ff5cb9e4bffeb841b3d5e172bd4f408a690f9a Mon Sep 17 00:00:00 2001 From: Christopher Liebman Date: Sat, 9 Dec 2017 06:24:15 -0800 Subject: [PATCH 09/36] Add WiFiManagerParameter destructor to free new'd _value, it was allocated but never free'd --- WiFiManager.cpp | 6 ++++++ WiFiManager.h | 1 + 2 files changed, 7 insertions(+) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 97c9eea..9d6dc3e 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -44,6 +44,12 @@ void WiFiManagerParameter::init(const char *id, const char *placeholder, const c _customHTML = custom; } +WiFiManagerParameter::~WiFiManagerParameter() { + if (_value != NULL) { + delete _value; + } +} + const char* WiFiManagerParameter::getValue() { return _value; } diff --git a/WiFiManager.h b/WiFiManager.h index 5b37e44..9a599db 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -42,6 +42,7 @@ class WiFiManagerParameter { WiFiManagerParameter(const char *custom); WiFiManagerParameter(const char *id, const char *placeholder, const char *defaultValue, int length); WiFiManagerParameter(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom); + ~WiFiManagerParameter(); const char *getID(); const char *getValue(); From 5c6252fe45144a6fcd5d67cc9c47e27fde33daa2 Mon Sep 17 00:00:00 2001 From: Christopher Liebman Date: Sat, 9 Dec 2017 08:37:35 -0800 Subject: [PATCH 10/36] should use delete[] not delete --- WiFiManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 9d6dc3e..ae04fa9 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -46,7 +46,7 @@ void WiFiManagerParameter::init(const char *id, const char *placeholder, const c WiFiManagerParameter::~WiFiManagerParameter() { if (_value != NULL) { - delete _value; + delete[] _value; } } From 8c906af56303f3125ac3b69b54059e87f1203ae1 Mon Sep 17 00:00:00 2001 From: Tiutiu Marius Cristian Date: Mon, 22 Jan 2018 12:42:23 +0200 Subject: [PATCH 11/36] make WIFI_MANAGER_MAX_PARAMS customizable --- WiFiManager.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/WiFiManager.h b/WiFiManager.h index 5b37e44..3da6da4 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -35,7 +35,9 @@ const char HTTP_SCAN_LINK[] PROGMEM = "
Date: Tue, 6 Feb 2018 14:12:13 +0100 Subject: [PATCH 12/36] Bug fix for problem discovered when setting length to 1 for additional parameters The initialization of the buffer holding the value stopped before the last character and storage did not take into account the extra-byte for end of string. --- WiFiManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index f97c4e5..7e9a9d9 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -34,7 +34,7 @@ void WiFiManagerParameter::init(const char *id, const char *placeholder, const c _placeholder = placeholder; _length = length; _value = new char[length + 1]; - for (int i = 0; i < length; i++) { + for (int i = 0; i < length + 1; i++) { _value[i] = 0; } if (defaultValue != NULL) { @@ -597,7 +597,7 @@ void WiFiManager::handleWifiSave() { //read parameter String value = server->arg(_params[i]->getID()).c_str(); //store it in array - value.toCharArray(_params[i]->_value, _params[i]->_length); + value.toCharArray(_params[i]->_value, _params[i]->_length + 1); DEBUG_WM(F("Parameter")); DEBUG_WM(_params[i]->getID()); DEBUG_WM(value); From a863167b23728903f0c4d8d82972d457a52b902a Mon Sep 17 00:00:00 2001 From: Jasper Date: Tue, 13 Feb 2018 11:16:37 +0800 Subject: [PATCH 13/36] 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 14/36] 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 15/36] 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 16/36] 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 17/36] 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 18/36] 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 19/36] 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 20/36] 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 21/36] 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 22/36] 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 23/36] 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; From 5a6a365f0af73313773655c8d4b0f3a0fbd9b2a6 Mon Sep 17 00:00:00 2001 From: Shawn A Date: Mon, 26 Feb 2018 22:11:43 -0600 Subject: [PATCH 24/36] Update CONTRIBUTING.md --- .github/CONTRIBUTING.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index a7dbf8b..6760b62 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -7,3 +7,6 @@ Please test against development branch before submitting issues, issues against 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. + +### Documentation is in progress +https://github.com/tzapu/WiFiManager/issues/500 From 108af72d5f2ee73713dc29ae7b697822990fbc0e Mon Sep 17 00:00:00 2001 From: Shawn A Date: Fri, 2 Mar 2018 12:42:20 -0600 Subject: [PATCH 25/36] Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 5700570..e77edf6 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -7,6 +7,8 @@ https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.rs for better debug messages: https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.rst +## PLEASE TRY DEVELOPMENT BRANCH BEFORE SUBMITTING BUGS ON RELEAASE, IN CASE THEY WERE ALREADY FIXED. ## + ----------------------------- Remove above ----------------------------- ### Basic Infos From 4f86945d7e4ddf4c4a959c4dd1c4ebb0b4fa2b9b Mon Sep 17 00:00:00 2001 From: Shawn A Date: Thu, 15 Mar 2018 07:44:26 -0500 Subject: [PATCH 26/36] Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index e77edf6..2deb942 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,3 +1,6 @@ +## PLEASE TRY DEVELOPMENT BRANCH before submitting bugs on release or master, in case they were already fixed. ## + +Issues without basic info will be ignored or closed! Please fill the info fields, it helps to get you faster support ;) @@ -7,8 +10,6 @@ https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.rs for better debug messages: https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.rst -## PLEASE TRY DEVELOPMENT BRANCH BEFORE SUBMITTING BUGS ON RELEAASE, IN CASE THEY WERE ALREADY FIXED. ## - ----------------------------- Remove above ----------------------------- ### Basic Infos @@ -16,6 +17,8 @@ https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.rst #### Hardware WiFimanager Branch/Release: Development +Esp8266/Esp32: + Hardware: ESP-12e, esp01, esp25 Core Version: 2.4.0, staging From 0749e1bdd76c811a5a554ff5cc5fe2fb02fa8dd2 Mon Sep 17 00:00:00 2001 From: Shawn A Date: Thu, 15 Mar 2018 16:05:02 -0500 Subject: [PATCH 27/36] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 10da7f6..3782339 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +## Current development going on here :arrow_right: [Development Branch](https://github.com/tzapu/WiFiManager/tree/development) + # WiFiManager ESP8266 WiFi Connection manager with fallback web configuration portal From d27fa7df618e7eaad7f54e26aec635e274dc2224 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Mon, 9 Apr 2018 19:16:12 -0500 Subject: [PATCH 28/36] hotfixing #425 this is a hotfix, there are numerous issues with this, development branch already addressed all of them. --- WiFiManager.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 1e6d805..ec235e8 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -197,9 +197,20 @@ boolean WiFiManager::startConfigPortal() { } boolean WiFiManager::startConfigPortal(char const *apName, char const *apPassword) { - //setup AP - WiFi.mode(WIFI_AP_STA); - DEBUG_WM(F("SET AP STA")); + + if(!WiFi.isConnected()){ + WiFi.persistent(false); + // disconnect sta, start ap + WiFi.disconnect(); // this alone is not enough to stop the autoconnecter + WiFi.mode(WIFI_AP); + WiFi.persistent(true); + } + else { + //setup AP + WiFi.mode(WIFI_AP_STA); + DEBUG_WM(F("SET AP STA")); + } + _apName = apName; _apPassword = apPassword; From 0f2ba754e2499e04c4d48d1ef00b488ae68f5778 Mon Sep 17 00:00:00 2001 From: vincentVDB Date: Tue, 10 Jul 2018 02:11:06 +0200 Subject: [PATCH 29/36] Update AutoConnectWithFSParameters.ino Close file ! --- .../AutoConnectWithFSParameters/AutoConnectWithFSParameters.ino | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/AutoConnectWithFSParameters/AutoConnectWithFSParameters.ino b/examples/AutoConnectWithFSParameters/AutoConnectWithFSParameters.ino index 1d58e5c..7e6c373 100644 --- a/examples/AutoConnectWithFSParameters/AutoConnectWithFSParameters.ino +++ b/examples/AutoConnectWithFSParameters/AutoConnectWithFSParameters.ino @@ -61,6 +61,7 @@ void setup() { } else { Serial.println("failed to load json config"); } + configFile.close(); } } } else { From 32495668d8ac691d72ec77b5e423c6f8d3d845b7 Mon Sep 17 00:00:00 2001 From: Shawn A Date: Sat, 14 Jul 2018 16:46:07 -0500 Subject: [PATCH 30/36] Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 2deb942..6fd55a7 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,5 +1,9 @@ ## PLEASE TRY DEVELOPMENT BRANCH before submitting bugs on release or master, in case they were already fixed. ## +## POST SERIAL OUTPUT ! +## POST SERIAL OUTPUT ! +## POST SERIAL OUTPUT ! + Issues without basic info will be ignored or closed! Please fill the info fields, it helps to get you faster support ;) From 704a7ae393e8b8f820a73924d0480aae85781c26 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Sun, 22 Jul 2018 10:47:33 -0500 Subject: [PATCH 31/36] hotfix WPS NO_EXTRA_4K_HEAP --- WiFiManager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index ec235e8..2e7884d 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -308,11 +308,13 @@ int WiFiManager::connectWifi(String ssid, String pass) { DEBUG_WM ("Connection result: "); DEBUG_WM ( connRes ); //not connected, WPS enabled, no pass - first attempt + #ifdef NO_EXTRA_4K_HEAP if (_tryWPS && connRes != WL_CONNECTED && pass == "") { startWPS(); //should be connected at the end of WPS connRes = waitForConnectResult(); } + #endif return connRes; } From 02de95c5293011f65c3b9f0f365ef5e7ef75d949 Mon Sep 17 00:00:00 2001 From: dontsovcmc Date: Sat, 4 Aug 2018 20:29:55 +0300 Subject: [PATCH 32/36] issuu #644 add utf-8 charset to head --- WiFiManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WiFiManager.h b/WiFiManager.h index 3da163e..64bb96e 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -22,7 +22,7 @@ extern "C" { #include "user_interface.h" } -const char HTTP_HEAD[] PROGMEM = "{v}"; +const char HTTP_HEAD[] PROGMEM = "{v}"; const char HTTP_STYLE[] PROGMEM = ""; const char HTTP_SCRIPT[] PROGMEM = ""; const char HTTP_HEAD_END[] PROGMEM = "
"; From 6a139688f3876b3bdf90d0a09b58dec04ce4b516 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Sun, 5 Aug 2018 11:03:39 -0500 Subject: [PATCH 33/36] ver .13 --- library.json | 2 +- library.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index 44400f6..27c6385 100644 --- a/library.json +++ b/library.json @@ -9,5 +9,5 @@ }, "frameworks": "arduino", "platforms": "espressif8266", - "version": "0.12" + "version": "0.13" } diff --git a/library.properties b/library.properties index 2466f0d..0fc964a 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=WiFiManager -version=0.12 +version=0.13 author=tzapu maintainer=tzapu sentence=ESP8266 WiFi Connection manager with fallback web configuration portal From 440f312575fc92ed7fe6eec9f81f33b1c011fbbe Mon Sep 17 00:00:00 2001 From: tablatronix Date: Sun, 5 Aug 2018 11:06:15 -0500 Subject: [PATCH 34/36] v 0.14 --- library.json | 2 +- library.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index 27c6385..8f0830a 100644 --- a/library.json +++ b/library.json @@ -9,5 +9,5 @@ }, "frameworks": "arduino", "platforms": "espressif8266", - "version": "0.13" + "version": "0.14" } diff --git a/library.properties b/library.properties index 0fc964a..e0420ad 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=WiFiManager -version=0.13 +version=0.14 author=tzapu maintainer=tzapu sentence=ESP8266 WiFi Connection manager with fallback web configuration portal From 805072c4c4d354e00c8bf15abbfe33f26b198a2b Mon Sep 17 00:00:00 2001 From: Shawn A Date: Wed, 29 Aug 2018 10:37:28 -0500 Subject: [PATCH 35/36] adds checkboxes --- .github/ISSUE_TEMPLATE.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 6fd55a7..499d50e 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -19,13 +19,24 @@ https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.rst ### Basic Infos #### Hardware -WiFimanager Branch/Release: Development +WiFimanager Branch/Release: +- [ ] Master +- [ ] Development -Esp8266/Esp32: +Esp8266/Esp32: +- [ ] ESP8266 +- [ ] ESP32 Hardware: ESP-12e, esp01, esp25 +- [ ] ESP01 +- [ ] ESP12 E/F/S (nodemcu, wemos, feather) +- [ ] Other -Core Version: 2.4.0, staging + +ESP Core Version: 2.4.0, staging +- [ ] 2.3.0 +- [ ] 2.4.0 +- [ ] staging (master/dev) ### Description From b2f6ff4a1fab22fe1800eea24a83d1d2c7add760 Mon Sep 17 00:00:00 2001 From: Shawn A Date: Wed, 29 Aug 2018 10:39:28 -0500 Subject: [PATCH 36/36] formatting --- .github/ISSUE_TEMPLATE.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 499d50e..b209e5e 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,7 +1,5 @@ ## PLEASE TRY DEVELOPMENT BRANCH before submitting bugs on release or master, in case they were already fixed. ## -## POST SERIAL OUTPUT ! -## POST SERIAL OUTPUT ! ## POST SERIAL OUTPUT ! Issues without basic info will be ignored or closed! @@ -19,21 +17,21 @@ https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.rst ### Basic Infos #### Hardware -WiFimanager Branch/Release: +**WiFimanager Branch/Release:** - [ ] Master - [ ] Development -Esp8266/Esp32: +**Esp8266/Esp32:** - [ ] ESP8266 - [ ] ESP32 -Hardware: ESP-12e, esp01, esp25 +**Hardware: ESP-12e, esp01, esp25** - [ ] ESP01 - [ ] ESP12 E/F/S (nodemcu, wemos, feather) - [ ] Other -ESP Core Version: 2.4.0, staging +**ESP Core Version: 2.4.0, staging** - [ ] 2.3.0 - [ ] 2.4.0 - [ ] staging (master/dev)