From 944450840aa7fd33a7c98082d70aef2567d8f6a8 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Thu, 20 Dec 2018 10:56:55 -0600 Subject: [PATCH 01/48] applies #772 to dev --- strings_en.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strings_en.h b/strings_en.h index b9939ea..c940467 100644 --- a/strings_en.h +++ b/strings_en.h @@ -13,7 +13,7 @@ #ifndef WIFI_MANAGER_OVERRIDE_STRINGS // !!! THIS DOES NOT WORK, you cannot define in a sketch, if anyone one knows how to order includes to be able to do this help! -const char HTTP_HEAD_START[] PROGMEM = "{v}"; +const char HTTP_HEAD_START[] PROGMEM = "{v}"; const char HTTP_SCRIPT[] PROGMEM = ""; const char HTTP_HEAD_END[] PROGMEM = "
"; From e25277b20cdcf9c588a2a3b0f0afed9830e2cf57 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Fri, 4 Jan 2019 09:37:07 -0600 Subject: [PATCH 02/48] make getRSSIQuality public --- WiFiManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WiFiManager.h b/WiFiManager.h index 2bd6923..dd1ab8a 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -165,6 +165,7 @@ class WiFiManager // get the AP name of the config portal, so it can be used in the callback String getConfigPortalSSID(); + int getRSSIasQuality(int RSSI); // erase wifi credentials void resetSettings(); @@ -439,7 +440,6 @@ class WiFiManager String getHTTPHead(String title); String getMenuOut(); //helpers - int getRSSIasQuality(int RSSI); boolean isIp(String str); String toStringIp(IPAddress ip); boolean validApPassword(); From aaf2544c931e28a28553c85242a375349ad313c3 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Fri, 4 Jan 2019 14:50:38 -0600 Subject: [PATCH 03/48] add sample oled support to DEV example --- .../OnDemandConfigPortal.ino | 56 ++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino b/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino index 4e14584..367bb22 100644 --- a/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino +++ b/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino @@ -7,6 +7,49 @@ #define TRIGGER_PIN 0 const char* modes[] = { "NULL", "STA", "AP", "STA+AP" }; +#define OLED + +#include +#include +#include +#ifdef OLED + +#define SCREEN_WIDTH 128 // OLED display width, in pixels +#define SCREEN_HEIGHT 32 // OLED display height, in pixels + +// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) +#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) +Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); + +void init_oled(){ + Wire.begin(SCL,SDA); // begin(sda, scl) SWAP! + // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally + if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32 + Serial.println(F("SSD1306 allocation failed")); + } + + display.clearDisplay(); + display.setTextSize(1); // Normal 1:1 pixepl scale + display.setTextColor(WHITE); // Draw white text + display.setCursor(0,0); // Start at top-left corner + display.display(); +} +#endif + +void print_oled(String str,uint8_t size){ + #ifdef OLED + display.clearDisplay(); + display.setTextSize(size); + display.setTextColor(WHITE); + display.setCursor(0,0); + display.println(str); + display.display(); + #else + (void)str; + (void)size; + #endif +} + WiFiManager wm; bool TEST_CP = false; // always start the configportal bool TEST_NET = true; // do a network test, get ntp time @@ -20,6 +63,7 @@ void saveWifiCallback(){ //gets called when WiFiManager enters configuration mode void configModeCallback (WiFiManager *myWiFiManager) { Serial.println("[CALLBACK] configModeCallback fired"); + print_oled("WiFiManager Waiting\nIP: " + WiFi.softAPIP().toString() + "\nSSID: " + WiFi.softAPSSID(),1); // myWiFiManager->setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0)); // Serial.println(WiFi.softAPIP()); //if you used auto generated SSID, print it @@ -44,11 +88,15 @@ void handleRoute(){ void setup() { // put your setup code here, to run once: Serial.begin(115200); - Serial.setDebugOutput(true); + // Serial.setDebugOutput(true); // delay(3000); Serial.println("\n Starting"); // WiFi.setSleepMode(WIFI_NONE_SLEEP); // disable sleep, can improve ap stability + #ifdef OLED + init_oled(); + #endif + print_oled(F("Starting..."),2); wm.debugPlatformInfo(); //Local intialization. Once its business is done, there is no need to keep it around @@ -121,8 +169,10 @@ void setup() { //here "AutoConnectAP" //and goes into a blocking loop awaiting configuration + print_oled(F("Connecting..."),2); if(!wm.autoConnect("AutoConnectAP")) { Serial.println("failed to connect and hit timeout"); + print_oled("Not Connected",2); } else if(TEST_CP) { // start configportal always @@ -132,6 +182,7 @@ void setup() { else { //if you get here you have connected to the WiFi Serial.println("connected...yeey :)"); + print_oled("Connected\nIP: " + WiFi.localIP().toString() + "\nSSID: " + WiFi.SSID(),1); } pinMode(TRIGGER_PIN, INPUT); } @@ -151,6 +202,7 @@ void loop() { } else { //if you get here you have connected to the WiFi Serial.println("connected...yeey :)"); + print_oled("Connected\nIP: " + WiFi.localIP().toString() + "\nSSID: " + WiFi.SSID(),1); getTime(); } } @@ -175,7 +227,7 @@ void getTime() { if((millis() - start) > timeout){ Serial.println("[ERROR] Failed to get NTP time."); return; - } + } } Serial.println(""); struct tm timeinfo; From 862e2dbde2b68d09e21c44dc984b754e1a05a37a Mon Sep 17 00:00:00 2001 From: tablatronix Date: Fri, 4 Jan 2019 14:54:31 -0600 Subject: [PATCH 04/48] stupid shit wont compile other stuff says not in scope , makes no sense --- .../OnDemandConfigPortal.ino | 69 ++++++++++--------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino b/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino index 367bb22..186f593 100644 --- a/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino +++ b/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino @@ -7,47 +7,52 @@ #define TRIGGER_PIN 0 const char* modes[] = { "NULL", "STA", "AP", "STA+AP" }; -#define OLED +// // #define MYOLED -#include -#include -#include -#ifdef OLED +// #include +// #include +// #include +// #ifdef MYOLED -#define SCREEN_WIDTH 128 // OLED display width, in pixels -#define SCREEN_HEIGHT 32 // OLED display height, in pixels +// #define SCREEN_WIDTH 128 // OLED display width, in pixels +// #define SCREEN_HEIGHT 32 // OLED display height, in pixels -// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) -#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) -Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); +// // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) +// #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) +// Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); -void init_oled(){ - Wire.begin(SCL,SDA); // begin(sda, scl) SWAP! - // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally - if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32 - Serial.println(F("SSD1306 allocation failed")); - } +// void init_oled(){ +// Wire.begin(SCL,SDA); // begin(sda, scl) SWAP! +// // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally +// if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32 +// Serial.println(F("SSD1306 allocation failed")); +// } - display.clearDisplay(); - display.setTextSize(1); // Normal 1:1 pixepl scale - display.setTextColor(WHITE); // Draw white text - display.setCursor(0,0); // Start at top-left corner - display.display(); -} -#endif +// display.clearDisplay(); +// display.setTextSize(1); // Normal 1:1 pixepl scale +// display.setTextColor(WHITE); // Draw white text +// display.setCursor(0,0); // Start at top-left corner +// display.display(); +// } + +// void print_oled(String str,uint8_t size){ +// display.clearDisplay(); +// display.setTextSize(size); +// display.setTextColor(WHITE); +// display.setCursor(0,0); +// display.println(str); +// display.display(); +// } +// #else +// void print_oled(String str,uint8_t size){ +// (void)str; +// (void)size; +// } +// #endif void print_oled(String str,uint8_t size){ - #ifdef OLED - display.clearDisplay(); - display.setTextSize(size); - display.setTextColor(WHITE); - display.setCursor(0,0); - display.println(str); - display.display(); - #else (void)str; (void)size; - #endif } WiFiManager wm; From 1282c4d5b520e447b51cbd9d107a72048b28724d Mon Sep 17 00:00:00 2001 From: sidey79 <7968127+sidey79@users.noreply.github.com> Date: Tue, 8 Jan 2019 23:33:56 +0100 Subject: [PATCH 05/48] wifimanager.cpp / wifimanager.h added define that checks on esp32 or esp8266. If another hardware is selectec, then do not try to compile this code. --- WiFiManager.cpp | 4 ++++ WiFiManager.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 37e86dc..f39be6c 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -12,6 +12,8 @@ #include "WiFiManager.h" +#if defined(ESP8266) || defined(ESP32) + #ifdef ESP32 uint8_t WiFiManager::_lastconxresulttmp = WL_IDLE_STATUS; #endif @@ -2700,3 +2702,5 @@ void WiFiManager::WiFi_autoReconnect(){ // } #endif } + +#endif \ No newline at end of file diff --git a/WiFiManager.h b/WiFiManager.h index dd1ab8a..cedbbb8 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -10,9 +10,12 @@ * @license MIT */ + #ifndef WiFiManager_h #define WiFiManager_h +#if defined(ESP8266) || defined(ESP32) + #ifdef ESP8266 #include #endif @@ -506,3 +509,5 @@ class WiFiManager }; #endif + +#endif \ No newline at end of file From 3717e323b9f524c4018cc883350db8072b5d3ff3 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Thu, 10 Jan 2019 15:37:12 -0600 Subject: [PATCH 06/48] adds password debugging --- WiFiManager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 37e86dc..508f031 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -766,6 +766,7 @@ uint8_t WiFiManager::connectWifi(String ssid, String pass) { bool WiFiManager::wifiConnectNew(String ssid, String pass){ bool ret = false; DEBUG_WM(F("Connecting to new AP:"),ssid); + DEBUG_WM(DEBUG_DEV,F("Using Password:"),pass); WiFi_enableSTA(true,storeSTAmode); // storeSTAmode will also toggle STA on in default opmode (persistent) if true (default) WiFi.persistent(true); ret = WiFi.begin(ssid.c_str(), pass.c_str()); @@ -782,6 +783,7 @@ bool WiFiManager::wifiConnectNew(String ssid, String pass){ bool WiFiManager::wifiConnectDefault(){ bool ret = false; DEBUG_WM(F("Connecting to saved AP:"),WiFi_SSID()); + DEBUG_WM(DEBUG_DEV,F("Using Password:"),WiFi.psk()); ret = WiFi_enableSTA(true,storeSTAmode); if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] wifi enableSta failed"); ret = WiFi.begin(); From 0e75b669b7af8db254fb830c0ca3d9806128c960 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Sun, 20 Jan 2019 10:11:24 -0600 Subject: [PATCH 07/48] change var name --- .../NonBlocking/OnDemandNonBlocking/onDemandNonBlocking.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/NonBlocking/OnDemandNonBlocking/onDemandNonBlocking.ino b/examples/NonBlocking/OnDemandNonBlocking/onDemandNonBlocking.ino index ef8e1eb..0079472 100644 --- a/examples/NonBlocking/OnDemandNonBlocking/onDemandNonBlocking.ino +++ b/examples/NonBlocking/OnDemandNonBlocking/onDemandNonBlocking.ino @@ -14,7 +14,7 @@ WiFiManager wm; unsigned int timeout = 120; // seconds to run for unsigned int startTime = millis(); bool portalRunning = false; -bool startCP = false; // start AP and webserver if true, else start only webserver +bool startAP = false; // start AP and webserver if true, else start only webserver void setup() { // put your setup code here, to run once @@ -35,7 +35,7 @@ void doWiFiManager(){ if((millis()-startTime) > (timeout*1000)){ Serial.println("portaltimeout"); portalRunning = false; - if(startCP){ + if(startAP){ wm.stopConfigPortal(); } else{ @@ -46,7 +46,7 @@ void doWiFiManager(){ // is configuration portal requested? if(digitalRead(TRIGGER_PIN) == LOW && (!portalRunning)) { - if(startCP){ + if(startAP){ Serial.println("Button Pressed, Starting Config Portal"); wm.setConfigPortalBlocking(false); wm.startConfigPortal(); From 9353fb01d36582049c2fbe803f6e74788355545c Mon Sep 17 00:00:00 2001 From: tablatronix Date: Tue, 19 Feb 2019 22:06:16 -0600 Subject: [PATCH 08/48] added debugging log --- WiFiManager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 508f031..67445dd 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -798,10 +798,12 @@ bool WiFiManager::wifiConnectDefault(){ * @return bool success */ bool WiFiManager::setSTAConfig(){ + DEBUG_WM(F("STA static IP:"),_sta_static_ip); bool ret = true; if (_sta_static_ip) { + DEBUG_WM(DEBUG_VERBOSE,F("Custom static IP/GW/Subnet/DNS")); if(_sta_static_dns) { - DEBUG_WM(DEBUG_VERBOSE,F("Custom STA IP/GW/Subnet/DNS")); + DEBUG_WM(DEBUG_VERBOSE,F("Custom static DNS")); ret = WiFi.config(_sta_static_ip, _sta_static_gw, _sta_static_sn, _sta_static_dns); } else { From 6131c2d38ae9a9efe61d2240e64653bbc7f6b371 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Sun, 24 Feb 2019 08:29:20 -0600 Subject: [PATCH 09/48] update basic.ino --- examples/Basic/Basic.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/Basic/Basic.ino b/examples/Basic/Basic.ino index 26ec6d4..381fab1 100644 --- a/examples/Basic/Basic.ino +++ b/examples/Basic/Basic.ino @@ -3,10 +3,12 @@ void setup() { // put your setup code here, to run once: Serial.begin(115200); + + // WiFi.mode(WiFi_STA); // it is a good practice to make sure your code sets wifi mode how you want it. //WiFiManager, Local intialization. Once its business is done, there is no need to keep it around WiFiManager wm; - + //reset settings - wipe credentials for testing //wm.resetSettings(); From 30fd2b13a669038a4b213d2f804a5f1f4ed37e69 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Sun, 24 Feb 2019 08:30:57 -0600 Subject: [PATCH 10/48] remove extra define init() --- WiFiManager.h | 1 - 1 file changed, 1 deletion(-) diff --git a/WiFiManager.h b/WiFiManager.h index cedbbb8..9b17f45 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -125,7 +125,6 @@ class WiFiManagerParameter { void setValue(const char *defaultValue, int length); protected: - void init(const char *id, const char *label, const char *defaultValue, int length, const char *custom); void init(const char *id, const char *label, const char *defaultValue, int length, const char *custom, int labelPlacement); private: From d6cf147e5b4148752df2faba8fc88963b7479be5 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Sun, 24 Feb 2019 08:41:33 -0600 Subject: [PATCH 11/48] fixing up travis, not sure why cpufreq is throwing errors or debug ? --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d41a13b..7544d8d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,14 +27,15 @@ install: - python2 get.py - popd # esp32 needs WebServer_tng for now - - git clone https://github.com/bbx10/WebServer_tng.git /usr/local/share/arduino/libraries/WebServer_tng + # - git clone https://github.com/bbx10/WebServer_tng.git /usr/local/share/arduino/libraries/WebServer_tng script: - "echo $PWD" - "echo $HOME" - "ls $PWD" - source $TRAVIS_BUILD_DIR/travis/common.sh - - arduino --board esp8266:esp8266:generic:CpuFrequency=80,CrystalFreq=26,FlashFreq=40,FlashMode=qio,FlashSize=4M1M,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs + # - arduino --board esp8266:esp8266:generic:CpuFrequency=80,CrystalFreq=26,FlashFreq=40,FlashMode=qio,FlashSize=4M1M,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs + - arduino --board esp8266:esp8266:generic:CrystalFreq=26,FlashFreq=40,FlashMode=qio,FlashSize=4M1M,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs - build_examples - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs # some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them From 621ac631548a811c77518cc50bbfdf5a8210b1cb Mon Sep 17 00:00:00 2001 From: tablatronix Date: Mon, 25 Feb 2019 08:46:10 -0600 Subject: [PATCH 12/48] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d41a13b..f8ff9d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ script: - "echo $HOME" - "ls $PWD" - source $TRAVIS_BUILD_DIR/travis/common.sh - - arduino --board esp8266:esp8266:generic:CpuFrequency=80,CrystalFreq=26,FlashFreq=40,FlashMode=qio,FlashSize=4M1M,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs + - arduino --board esp8266:esp8266:generic:xtal=80,CrystalFreq=26,eesz=40,FlashMode=qio,FlashSize=4M1M,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs - build_examples - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs # some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them From ea1a09130f112f61e2d62c92fc6d1e7e901a76e4 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Tue, 26 Feb 2019 21:36:25 -0600 Subject: [PATCH 13/48] fix #771 again, I never set hasbegun to true! should fix esp32 events not working, namely async scannetworks --- WiFiManager.cpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 9423276..93810c7 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -197,7 +197,7 @@ void WiFiManager::WiFiManagerInit(){ WiFiManager::~WiFiManager() { _end(); // parameters - // @todo belongs to wifimanagerparameter + // @todo below belongs to wifimanagerparameter if (_params != NULL){ DEBUG_WM(DEBUG_DEV,F("freeing allocated params!")); free(_params); @@ -214,6 +214,7 @@ WiFiManager::~WiFiManager() { void WiFiManager::_begin(){ if(_hasBegun) return; + _hasBegun = true; _usermode = WiFi.getMode(); #ifndef ESP32 @@ -1049,16 +1050,17 @@ bool WiFiManager::WiFi_scanNetworks(bool force,bool async){ int8_t res; _startscan = millis(); if(async){ - DEBUG_WM(DEBUG_VERBOSE,F("WiFi Scan ASYNC started")); #ifdef ESP8266 - #ifndef WM_NOASYNC // no async available < 2.4.0 - using namespace std::placeholders; // for `_1` - WiFi.scanNetworksAsync(std::bind(&WiFiManager::WiFi_scanComplete,this,_1)); + #ifndef WM_NOASYNC // no async available < 2.4.0 + DEBUG_WM(DEBUG_VERBOSE,F("WiFi Scan ASYNC started")); + using namespace std::placeholders; // for `_1` + WiFi.scanNetworksAsync(std::bind(&WiFiManager::WiFi_scanComplete,this,_1)); + #else + res = WiFi.scanNetworks(); + #endif #else - res = WiFi.scanNetworks(); - #endif - #else - res = WiFi.scanNetworks(true); + DEBUG_WM(DEBUG_VERBOSE,F("WiFi Scan ASYNC started")); + res = WiFi.scanNetworks(true); #endif return false; } @@ -1984,6 +1986,7 @@ void WiFiManager::setSaveConnectTimeout(unsigned long seconds) { */ void WiFiManager::setDebugOutput(boolean debug) { _debug = debug; + if(_debug && _debugLevel == DEBUG_DEV) debugPlatformInfo(); } /** @@ -2675,8 +2678,11 @@ String WiFiManager::WiFi_SSID(){ #ifdef ESP32 void WiFiManager::WiFiEvent(WiFiEvent_t event,system_event_info_t info){ - if(!_hasBegun) return; DEBUG_WM(DEBUG_VERBOSE,"[EVENT]",event); + if(!_hasBegun){ + // DEBUG_WM(DEBUG_VERBOSE,"[ERROR] WiFiEvent, not ready"); + return; + } if(event == SYSTEM_EVENT_STA_DISCONNECTED){ DEBUG_WM(DEBUG_VERBOSE,"[EVENT] WIFI_REASON:",info.disconnected.reason); if(info.disconnected.reason == WIFI_REASON_AUTH_EXPIRE || info.disconnected.reason == WIFI_REASON_AUTH_FAIL){ @@ -2700,6 +2706,7 @@ void WiFiManager::WiFi_autoReconnect(){ WiFi.setAutoReconnect(_wifiAutoReconnect); #elif defined(ESP32) // if(_wifiAutoReconnect){ + // @todo move to seperate method, used for event listener now DEBUG_WM(DEBUG_VERBOSE,"ESP32 event handler enabled"); using namespace std::placeholders; WiFi.onEvent(std::bind(&WiFiManager::WiFiEvent,this,_1,_2)); From 4873c7c6326fcbfb069731035b1ed79ebd11746a Mon Sep 17 00:00:00 2001 From: tablatronix Date: Tue, 26 Feb 2019 21:37:57 -0600 Subject: [PATCH 14/48] silence event debug --- WiFiManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 93810c7..881f979 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -2678,11 +2678,11 @@ String WiFiManager::WiFi_SSID(){ #ifdef ESP32 void WiFiManager::WiFiEvent(WiFiEvent_t event,system_event_info_t info){ - DEBUG_WM(DEBUG_VERBOSE,"[EVENT]",event); if(!_hasBegun){ // DEBUG_WM(DEBUG_VERBOSE,"[ERROR] WiFiEvent, not ready"); return; } + // DEBUG_WM(DEBUG_VERBOSE,"[EVENT]",event); if(event == SYSTEM_EVENT_STA_DISCONNECTED){ DEBUG_WM(DEBUG_VERBOSE,"[EVENT] WIFI_REASON:",info.disconnected.reason); if(info.disconnected.reason == WIFI_REASON_AUTH_EXPIRE || info.disconnected.reason == WIFI_REASON_AUTH_FAIL){ From 7fbb941383fecdbe847b23c05a26cb5661215e88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikdat=20DO=C4=9ERU?= Date: Sun, 2 Jun 2019 18:27:50 +0300 Subject: [PATCH 15/48] Update WiFiManager.cpp i wrapped to int() function, because cannot match on css because the incoming data is decimal --- WiFiManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 881f979..55e285f 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -1164,7 +1164,7 @@ String WiFiManager::WiFiManager::getScanItemOut(){ if(tok_e) item.replace(FPSTR(T_e), encryptionTypeStr(enc_type)); if(tok_r) item.replace(FPSTR(T_r), (String)rssiperc); // rssi percentage 0-100 if(tok_R) item.replace(FPSTR(T_R), (String)WiFi.RSSI(indices[i])); // rssi db - if(tok_q) item.replace(FPSTR(T_q), (String)round(map(rssiperc,0,100,1,4))); //quality icon 1-4 + if(tok_q) item.replace(FPSTR(T_q), (String)int(round(map(rssiperc,0,100,1,4)))); //quality icon 1-4 if(tok_i){ if (enc_type != WM_WIFIOPEN) { item.replace(FPSTR(T_i), F("l")); @@ -2714,4 +2714,4 @@ void WiFiManager::WiFi_autoReconnect(){ #endif } -#endif \ No newline at end of file +#endif From 318742e18337affdbdb7d767d1af263f92e83a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikdat=20DO=C4=9ERU?= Date: Sun, 2 Jun 2019 18:58:13 +0300 Subject: [PATCH 16/48] Update WiFiManager.template.html parse.js parsing error fixed --- extras/WiFiManager.template.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/WiFiManager.template.html b/extras/WiFiManager.template.html index bfda6fe..657a1e4 100644 --- a/extras/WiFiManager.template.html +++ b/extras/WiFiManager.template.html @@ -253,7 +253,7 @@ button.D{
AP not found - +
Could not Connect From d20b85a7b80ae78e766e793cdde2ac3172f8c175 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Sat, 13 Jul 2019 06:53:58 -0500 Subject: [PATCH 17/48] remove geenric from travis for now --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f8ff9d8..3691d3f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ script: - "echo $HOME" - "ls $PWD" - source $TRAVIS_BUILD_DIR/travis/common.sh - - arduino --board esp8266:esp8266:generic:xtal=80,CrystalFreq=26,eesz=40,FlashMode=qio,FlashSize=4M1M,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs + - arduino --board esp8266:esp8266:xtal=80,CrystalFreq=26,eesz=40,FlashMode=qio,FlashSize=4M1M,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs - build_examples - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs # some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them From debb20e41b5100046f4c6778427d060241b3e807 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Sat, 13 Jul 2019 06:56:20 -0500 Subject: [PATCH 18/48] Revert "remove geenric from travis for now" This reverts commit d20b85a7b80ae78e766e793cdde2ac3172f8c175. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3691d3f..f8ff9d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ script: - "echo $HOME" - "ls $PWD" - source $TRAVIS_BUILD_DIR/travis/common.sh - - arduino --board esp8266:esp8266:xtal=80,CrystalFreq=26,eesz=40,FlashMode=qio,FlashSize=4M1M,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs + - arduino --board esp8266:esp8266:generic:xtal=80,CrystalFreq=26,eesz=40,FlashMode=qio,FlashSize=4M1M,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs - build_examples - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs # some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them From a1c53d785fa2f9ad11b9317c3a9460b00f01d037 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Sat, 13 Jul 2019 07:00:13 -0500 Subject: [PATCH 19/48] travis fqbn updates just removing bad ones for now, will fix later --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f8ff9d8..ec2e2fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,14 +27,14 @@ install: - python2 get.py - popd # esp32 needs WebServer_tng for now - - git clone https://github.com/bbx10/WebServer_tng.git /usr/local/share/arduino/libraries/WebServer_tng + # - git clone https://github.com/bbx10/WebServer_tng.git /usr/local/share/arduino/libraries/WebServer_tng script: - "echo $PWD" - "echo $HOME" - "ls $PWD" - source $TRAVIS_BUILD_DIR/travis/common.sh - - arduino --board esp8266:esp8266:generic:xtal=80,CrystalFreq=26,eesz=40,FlashMode=qio,FlashSize=4M1M,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs + - arduino --board esp8266:esp8266:generic:xtal=80,CrystalFreq=26,FlashMode=qio,FlashSize=4M1M,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs - build_examples - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs # some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them From 49c6cec9981f40b4fa493d065f83a5b05ea9dbd6 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Sat, 13 Jul 2019 07:08:35 -0500 Subject: [PATCH 20/48] ugh wtf --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ec2e2fb..b05ca05 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ script: - "echo $HOME" - "ls $PWD" - source $TRAVIS_BUILD_DIR/travis/common.sh - - arduino --board esp8266:esp8266:generic:xtal=80,CrystalFreq=26,FlashMode=qio,FlashSize=4M1M,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs + - arduino --board esp8266:esp8266:nodemcuv2:xtal=80,CrystalFreq=26,FlashMode=qio,FlashSize=4M1M,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs - build_examples - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs # some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them From 848311886041294b3479e80be3bb4fc2e713e4dd Mon Sep 17 00:00:00 2001 From: tablatronix Date: Sat, 13 Jul 2019 07:15:32 -0500 Subject: [PATCH 21/48] all jacked up --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b05ca05..518ef8f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ script: - "echo $HOME" - "ls $PWD" - source $TRAVIS_BUILD_DIR/travis/common.sh - - arduino --board esp8266:esp8266:nodemcuv2:xtal=80,CrystalFreq=26,FlashMode=qio,FlashSize=4M1M,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs + - arduino --board esp8266:esp8266:nodemcuv2:xtal=80,CrystalFreq=26,FlashMode=qio,eesz=4M1M,led=2,LwIPVariant=v2mss536,dbg=Serial,lvl=CORE --save-prefs - build_examples - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs # some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them From 35a1ab2e8dacc5ab6d6e28fefcdeb9eb9113f3ec Mon Sep 17 00:00:00 2001 From: tablatronix Date: Sat, 13 Jul 2019 07:18:23 -0500 Subject: [PATCH 22/48] remove crytalfreq --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 518ef8f..89072f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ script: - "echo $HOME" - "ls $PWD" - source $TRAVIS_BUILD_DIR/travis/common.sh - - arduino --board esp8266:esp8266:nodemcuv2:xtal=80,CrystalFreq=26,FlashMode=qio,eesz=4M1M,led=2,LwIPVariant=v2mss536,dbg=Serial,lvl=CORE --save-prefs + - arduino --board esp8266:esp8266:nodemcuv2:xtal=80,FlashMode=qio,eesz=4M1M,led=2,LwIPVariant=v2mss536,dbg=Serial,lvl=CORE --save-prefs - build_examples - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs # some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them From 5685e7d9b46e4b1ba6bb22bd38876d7c16382927 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Sat, 13 Jul 2019 07:21:19 -0500 Subject: [PATCH 23/48] ugh boards is so whack --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 89072f9..b3f0dc4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ script: - "echo $HOME" - "ls $PWD" - source $TRAVIS_BUILD_DIR/travis/common.sh - - arduino --board esp8266:esp8266:nodemcuv2:xtal=80,FlashMode=qio,eesz=4M1M,led=2,LwIPVariant=v2mss536,dbg=Serial,lvl=CORE --save-prefs + - arduino --board esp8266:esp8266:generic:xtal=80,FlashMode=qio,eesz=4M1M,led=2,LwIPVariant=v2mss536,dbg=Serial,lvl=CORE --save-prefs - build_examples - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs # some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them From e0e0150f7815829b5b117ce4953fd7efeae8b358 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Sat, 13 Jul 2019 07:34:57 -0500 Subject: [PATCH 24/48] why did they change every flag????? --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b3f0dc4..25d31a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ script: - "echo $HOME" - "ls $PWD" - source $TRAVIS_BUILD_DIR/travis/common.sh - - arduino --board esp8266:esp8266:generic:xtal=80,FlashMode=qio,eesz=4M1M,led=2,LwIPVariant=v2mss536,dbg=Serial,lvl=CORE --save-prefs + - arduino --board esp8266:esp8266:generic:xtal=80,FlashMode=qio,eesz=4M1M,led=2,dbg=Serial,lvl=CORE --save-prefs - build_examples - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs # some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them From b5218d1b93004e1b49722a4c11008d803c1334c3 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Fri, 19 Jul 2019 08:04:46 -0500 Subject: [PATCH 25/48] fix travis compile on esp32 --- examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino b/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino index 186f593..d4042c8 100644 --- a/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino +++ b/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino @@ -68,7 +68,9 @@ void saveWifiCallback(){ //gets called when WiFiManager enters configuration mode void configModeCallback (WiFiManager *myWiFiManager) { Serial.println("[CALLBACK] configModeCallback fired"); - print_oled("WiFiManager Waiting\nIP: " + WiFi.softAPIP().toString() + "\nSSID: " + WiFi.softAPSSID(),1); + #ifdef ESP8266 + print_oled("WiFiManager Waiting\nIP: " + WiFi.softAPIP().toString() + "\nSSID: " + WiFi.softAPSSID(),1); + #endif // myWiFiManager->setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0)); // Serial.println(WiFi.softAPIP()); //if you used auto generated SSID, print it From 8a8e363cc36c446057e4d1e9b8b95fcdea6aa64e Mon Sep 17 00:00:00 2001 From: tablatronix Date: Fri, 19 Jul 2019 08:23:21 -0500 Subject: [PATCH 26/48] Can i just do esp32 boards install now ? --- .travis.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 25d31a4..d12a383 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,15 +17,17 @@ install: - arduino --install-boards esp8266:esp8266 - arduino --pref "compiler.warning_level=all" --save-prefs # install esp32 - - pushd . - - mkdir -p ~/Arduino/hardware/espressif - - cd ~/Arduino/hardware/espressif - - git clone https://github.com/espressif/arduino-esp32.git esp32 - - cd esp32 - - git submodule update --init --recursive - - cd tools - - python2 get.py - - popd +# @todo install via boards now since it has been released? + - arduino --install-boards espressif:esp32 + # - pushd . + # - mkdir -p ~/Arduino/hardware/espressif + # - cd ~/Arduino/hardware/espressif + # - git clone https://github.com/espressif/arduino-esp32.git esp32 + # - cd esp32 + # - git submodule update --init --recursive + # - cd tools + # - python2 get.py + # - popd # esp32 needs WebServer_tng for now # - git clone https://github.com/bbx10/WebServer_tng.git /usr/local/share/arduino/libraries/WebServer_tng From 4775b1df510fd016aa46f04414ff8831e3a29474 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Fri, 19 Jul 2019 09:19:39 -0500 Subject: [PATCH 27/48] ok maybe not --- .travis.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index d12a383..92ccf46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,16 +18,16 @@ install: - arduino --pref "compiler.warning_level=all" --save-prefs # install esp32 # @todo install via boards now since it has been released? - - arduino --install-boards espressif:esp32 - # - pushd . - # - mkdir -p ~/Arduino/hardware/espressif - # - cd ~/Arduino/hardware/espressif - # - git clone https://github.com/espressif/arduino-esp32.git esp32 - # - cd esp32 - # - git submodule update --init --recursive - # - cd tools - # - python2 get.py - # - popd + # - arduino --install-boards espressif:esp32 + - pushd . + - mkdir -p ~/Arduino/hardware/espressif + - cd ~/Arduino/hardware/espressif + - git clone https://github.com/espressif/arduino-esp32.git esp32 + - cd esp32 + - git submodule update --init --recursive + - cd tools + - python2 get.py + - popd # esp32 needs WebServer_tng for now # - git clone https://github.com/bbx10/WebServer_tng.git /usr/local/share/arduino/libraries/WebServer_tng From 7446edf5474ac43ee858191f60dde3601b5194d0 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Mon, 29 Jul 2019 13:48:53 -0500 Subject: [PATCH 28/48] remove esp32 travis --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f8ff9d8..a7d8748 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,9 +36,9 @@ script: - source $TRAVIS_BUILD_DIR/travis/common.sh - arduino --board esp8266:esp8266:generic:xtal=80,CrystalFreq=26,eesz=40,FlashMode=qio,FlashSize=4M1M,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs - build_examples - - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs + # - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs # some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them - - build_examples + # - build_examples # - arduino -v --verbose-build --verify $PWD/examples/AutoConnect/AutoConnect.ino # no coverage generated, no need to run From 5b997e059746ee6d10b7524cd23a266f8411b913 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Mon, 29 Jul 2019 14:02:47 -0500 Subject: [PATCH 29/48] trying to fix travis again --- .travis.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7016294..bf1c35b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,8 +17,6 @@ install: - arduino --install-boards esp8266:esp8266 - arduino --pref "compiler.warning_level=all" --save-prefs # install esp32 -# @todo install via boards now since it has been released? - # - arduino --install-boards espressif:esp32 - pushd . - mkdir -p ~/Arduino/hardware/espressif - cd ~/Arduino/hardware/espressif @@ -36,11 +34,11 @@ script: - "echo $HOME" - "ls $PWD" - source $TRAVIS_BUILD_DIR/travis/common.sh - - arduino --board esp8266:esp8266:generic:xtal=80,FlashMode=qio,eesz=4M1M,led=2,dbg=Serial,lvl=CORE --save-prefs + - arduino --board esp8266:esp8266:generic:xtal=80,eesz=4M1M,FlashMode=qio,FlashFreq=80,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs - build_examples - # - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs + - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs # some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them - # - build_examples + - build_examples # - arduino -v --verbose-build --verify $PWD/examples/AutoConnect/AutoConnect.ino # no coverage generated, no need to run From 7f414f52248a9492d0bcfefbb1bc70f6c2387597 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Mon, 29 Jul 2019 14:10:01 -0500 Subject: [PATCH 30/48] dumb --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bf1c35b..26cd810 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ script: - "echo $HOME" - "ls $PWD" - source $TRAVIS_BUILD_DIR/travis/common.sh - - arduino --board esp8266:esp8266:generic:xtal=80,eesz=4M1M,FlashMode=qio,FlashFreq=80,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs + - arduino --board esp8266:esp8266:generic:xtal=80,eesz=4M1M,FlashMode=qio,FlashFreq=80,Debug=Serial,DebugLevel=CORE --save-prefs - build_examples - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs # some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them From 422ce3e16585ff47c55bf45559ee2e3287241216 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Mon, 29 Jul 2019 14:13:39 -0500 Subject: [PATCH 31/48] not sure how this all got changed --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 26cd810..17b0276 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ script: - "echo $HOME" - "ls $PWD" - source $TRAVIS_BUILD_DIR/travis/common.sh - - arduino --board esp8266:esp8266:generic:xtal=80,eesz=4M1M,FlashMode=qio,FlashFreq=80,Debug=Serial,DebugLevel=CORE --save-prefs + - arduino --board esp8266:esp8266:generic:xtal=80,eesz=4M1M,FlashMode=qio,FlashFreq=80,dbg=Serial,lvl=CORE --save-prefs - build_examples - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs # some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them From 6e1104efbfda492aa98c05a58580e7d869f2c6ca Mon Sep 17 00:00:00 2001 From: tablatronix Date: Mon, 29 Jul 2019 15:08:34 -0500 Subject: [PATCH 32/48] esp8266 build passing, work on esp32 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 17b0276..d4c4a34 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,7 @@ script: - source $TRAVIS_BUILD_DIR/travis/common.sh - arduino --board esp8266:esp8266:generic:xtal=80,eesz=4M1M,FlashMode=qio,FlashFreq=80,dbg=Serial,lvl=CORE --save-prefs - build_examples - - arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs + - arduino --board esp32:esp32:esp32:FlashFreq=80,FlashSize=4M,DebugLevel=info --save-prefs # some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them - build_examples # - arduino -v --verbose-build --verify $PWD/examples/AutoConnect/AutoConnect.ino From 41810a344a03bca0468483b1e2793727904b0764 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Mon, 29 Jul 2019 16:06:57 -0500 Subject: [PATCH 33/48] bump arduino 1.8.8, install boards esp32 --- .travis.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index d4c4a34..7da81e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,27 +5,28 @@ before_install: - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16" - sleep 3 - export DISPLAY=:1.0 - - wget http://downloads.arduino.cc/arduino-1.8.5-linux64.tar.xz - - tar xf arduino-1.8.5-linux64.tar.xz - - sudo mv arduino-1.8.5 /usr/local/share/arduino + - wget http://downloads.arduino.cc/arduino-1.8.8-linux64.tar.xz + - tar xf arduino-1.8.8-linux64.tar.xz + - sudo mv arduino-1.8.8 /usr/local/share/arduino - sudo ln -s /usr/local/share/arduino/arduino /usr/local/bin/arduino install: - ln -s $PWD /usr/local/share/arduino/libraries/WiFiManager - - arduino --pref "boardsmanager.additional.urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json" --save-prefs + - arduino --pref "boardsmanager.additional.urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json,http://dl.espressif.com/dl/package_esp32_index.json" --save-prefs - arduino --install-library "ArduinoJson:5.13.2" - arduino --install-boards esp8266:esp8266 - arduino --pref "compiler.warning_level=all" --save-prefs # install esp32 - - pushd . - - mkdir -p ~/Arduino/hardware/espressif - - cd ~/Arduino/hardware/espressif - - git clone https://github.com/espressif/arduino-esp32.git esp32 - - cd esp32 - - git submodule update --init --recursive - - cd tools - - python2 get.py - - popd + - arduino --install-boards esp32:esp32 + # - pushd . + # - mkdir -p ~/Arduino/hardware/espressif + # - cd ~/Arduino/hardware/espressif + # - git clone https://github.com/espressif/arduino-esp32.git esp32 + # - cd esp32 + # - git submodule update --init --recursive + # - cd tools + # - python2 get.py + # - popd # esp32 needs WebServer_tng for now # - git clone https://github.com/bbx10/WebServer_tng.git /usr/local/share/arduino/libraries/WebServer_tng From e2d7ae75335b596d58de5c5681c924310550ab21 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Mon, 29 Jul 2019 16:33:59 -0500 Subject: [PATCH 34/48] ESP32 DEFINE LED_BUILTIN --- .../AutoConnectWithFeedbackLED.ino | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/AutoConnect/AutoConnectWithFeedbackLED/AutoConnectWithFeedbackLED.ino b/examples/AutoConnect/AutoConnectWithFeedbackLED/AutoConnectWithFeedbackLED.ino index 532ceec..72279a0 100644 --- a/examples/AutoConnect/AutoConnectWithFeedbackLED/AutoConnectWithFeedbackLED.ino +++ b/examples/AutoConnect/AutoConnectWithFeedbackLED/AutoConnectWithFeedbackLED.ino @@ -5,7 +5,12 @@ //for LED status #include Ticker ticker; -int LED = BUILTIN_LED; + +#ifndef LED_BUILTIN +#define LED_BUILTIN 13 // ESP32 DOES NOT DEFINE LED_BUILTIN +#endif + +int LED = LED_BUILTIN; void tick() { From 34d9a975b5339bb5510f5718fbd1530dff9de733 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Mon, 29 Jul 2019 16:59:50 -0500 Subject: [PATCH 35/48] remove reeadme self reffeential link --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 7e53338..fb03403 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -## 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 1b8d870c226e39c7eae824b2e694cb306dcc312e Mon Sep 17 00:00:00 2001 From: tablatronix Date: Wed, 14 Aug 2019 13:40:19 -0500 Subject: [PATCH 36/48] add explicit mode to all examples So people stop complaining when ap starts by default cause they dont know how esp works. --- examples/Advanced/Advanced.ino | 1 + .../AutoConnectWithFSParametersAndCustomIP.ino | 1 + .../AutoConnectWithFeedbackLED.ino | 1 + examples/Basic/Basic.ino | 2 ++ examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino | 5 +++++ .../AutoConnectNonBlocking/AutoConnectNonBlocking.ino | 1 + .../AutoConnectNonBlockingwParams.ino | 1 + .../NonBlocking/OnDemandNonBlocking/onDemandNonBlocking.ino | 1 + .../OnDemand/OnDemandConfigPortal/OnDemandConfigPortal.ino | 1 + examples/OnDemand/OnDemandWebPortal/onDemandWebPortal.ino | 1 + examples/ParamsChildClass/ParamsChildClass.ino | 3 ++- 11 files changed, 17 insertions(+), 1 deletion(-) diff --git a/examples/Advanced/Advanced.ino b/examples/Advanced/Advanced.ino index 267bcbb..6e4ff73 100644 --- a/examples/Advanced/Advanced.ino +++ b/examples/Advanced/Advanced.ino @@ -10,6 +10,7 @@ WiFiManager wm; // global wm instance WiFiManagerParameter custom_field; // global param ( for non blocking w params ) void setup() { + WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP Serial.begin(115200); Serial.setDebugOutput(true); delay(3000); diff --git a/examples/AutoConnect/AutoConnectWithFSParametersAndCustomIP/AutoConnectWithFSParametersAndCustomIP.ino b/examples/AutoConnect/AutoConnectWithFSParametersAndCustomIP/AutoConnectWithFSParametersAndCustomIP.ino index 35b32ed..6b1a7af 100644 --- a/examples/AutoConnect/AutoConnectWithFSParametersAndCustomIP/AutoConnectWithFSParametersAndCustomIP.ino +++ b/examples/AutoConnect/AutoConnectWithFSParametersAndCustomIP/AutoConnectWithFSParametersAndCustomIP.ino @@ -77,6 +77,7 @@ void setupSpiffs(){ } void setup() { + WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP // put your setup code here, to run once: Serial.begin(115200); Serial.println(); diff --git a/examples/AutoConnect/AutoConnectWithFeedbackLED/AutoConnectWithFeedbackLED.ino b/examples/AutoConnect/AutoConnectWithFeedbackLED/AutoConnectWithFeedbackLED.ino index 72279a0..ba46843 100644 --- a/examples/AutoConnect/AutoConnectWithFeedbackLED/AutoConnectWithFeedbackLED.ino +++ b/examples/AutoConnect/AutoConnectWithFeedbackLED/AutoConnectWithFeedbackLED.ino @@ -29,6 +29,7 @@ void configModeCallback (WiFiManager *myWiFiManager) { } void setup() { + WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP // put your setup code here, to run once: Serial.begin(115200); diff --git a/examples/Basic/Basic.ino b/examples/Basic/Basic.ino index 381fab1..daaee37 100644 --- a/examples/Basic/Basic.ino +++ b/examples/Basic/Basic.ino @@ -1,6 +1,8 @@ #include // https://github.com/tzapu/WiFiManager void setup() { + WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP + // put your setup code here, to run once: Serial.begin(115200); diff --git a/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino b/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino index d4042c8..55211cc 100644 --- a/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino +++ b/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino @@ -93,6 +93,7 @@ void handleRoute(){ } void setup() { + WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP // put your setup code here, to run once: Serial.begin(115200); // Serial.setDebugOutput(true); @@ -127,6 +128,9 @@ void setup() { WiFiManagerParameter custom_tokenb("invalid token", "invalid token", "", 0); // id is invalid, cannot contain spaces WiFiManagerParameter custom_ipaddress("input_ip", "input IP", "", 15,"pattern='\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}'"); // custom input attrs (ip mask) + const char _customHtml_checkbox[] = "type=\"checkbox\""; + WiFiManagerParameter custom_checkbox("checkbox", "my checkbox", "T", 2, _customHtml_checkbox, WFM_LABEL_AFTER); + // callbacks wm.setAPCallback(configModeCallback); wm.setWebServerCallback(bindServerCallback); @@ -140,6 +144,7 @@ void setup() { wm.addParameter(&custom_token); wm.addParameter(&custom_tokenb); wm.addParameter(&custom_ipaddress); + wm.addParameter(&custom_checkbox); custom_html.setValue("test",4); custom_token.setValue("test",4); diff --git a/examples/NonBlocking/AutoConnectNonBlocking/AutoConnectNonBlocking.ino b/examples/NonBlocking/AutoConnectNonBlocking/AutoConnectNonBlocking.ino index 3187bec..fa04d91 100644 --- a/examples/NonBlocking/AutoConnectNonBlocking/AutoConnectNonBlocking.ino +++ b/examples/NonBlocking/AutoConnectNonBlocking/AutoConnectNonBlocking.ino @@ -2,6 +2,7 @@ WiFiManager wm; void setup() { + WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP // put your setup code here, to run once: Serial.begin(115200); diff --git a/examples/NonBlocking/AutoConnectNonBlockingwParams/AutoConnectNonBlockingwParams.ino b/examples/NonBlocking/AutoConnectNonBlockingwParams/AutoConnectNonBlockingwParams.ino index f5d4881..3af79f0 100644 --- a/examples/NonBlocking/AutoConnectNonBlockingwParams/AutoConnectNonBlockingwParams.ino +++ b/examples/NonBlocking/AutoConnectNonBlockingwParams/AutoConnectNonBlockingwParams.ino @@ -3,6 +3,7 @@ WiFiManager wm; WiFiManagerParameter custom_mqtt_server("server", "mqtt server", "", 40); void setup() { + WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP // put your setup code here, to run once: Serial.begin(115200); diff --git a/examples/NonBlocking/OnDemandNonBlocking/onDemandNonBlocking.ino b/examples/NonBlocking/OnDemandNonBlocking/onDemandNonBlocking.ino index 0079472..7ebd8d5 100644 --- a/examples/NonBlocking/OnDemandNonBlocking/onDemandNonBlocking.ino +++ b/examples/NonBlocking/OnDemandNonBlocking/onDemandNonBlocking.ino @@ -17,6 +17,7 @@ bool portalRunning = false; bool startAP = false; // start AP and webserver if true, else start only webserver void setup() { + WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP // put your setup code here, to run once Serial.begin(115200); Serial.println("\n Starting"); diff --git a/examples/OnDemand/OnDemandConfigPortal/OnDemandConfigPortal.ino b/examples/OnDemand/OnDemandConfigPortal/OnDemandConfigPortal.ino index e9252c3..a352b38 100644 --- a/examples/OnDemand/OnDemandConfigPortal/OnDemandConfigPortal.ino +++ b/examples/OnDemand/OnDemandConfigPortal/OnDemandConfigPortal.ino @@ -12,6 +12,7 @@ int timeout = 120; // seconds to run for void setup() { + WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP // put your setup code here, to run once: Serial.begin(115200); Serial.println("\n Starting"); diff --git a/examples/OnDemand/OnDemandWebPortal/onDemandWebPortal.ino b/examples/OnDemand/OnDemandWebPortal/onDemandWebPortal.ino index d3cbe3f..7b6676a 100644 --- a/examples/OnDemand/OnDemandWebPortal/onDemandWebPortal.ino +++ b/examples/OnDemand/OnDemandWebPortal/onDemandWebPortal.ino @@ -12,6 +12,7 @@ WiFiManager wm; bool portalRunning = false; void setup() { + WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP // put your setup code here, to run once Serial.begin(115200); Serial.println("\n Starting"); diff --git a/examples/ParamsChildClass/ParamsChildClass.ino b/examples/ParamsChildClass/ParamsChildClass.ino index c5d991a..0117d77 100644 --- a/examples/ParamsChildClass/ParamsChildClass.ino +++ b/examples/ParamsChildClass/ParamsChildClass.ino @@ -52,8 +52,9 @@ struct Settings { void setup() { + WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP pinMode(SETUP_PIN, INPUT_PULLUP); - Serial.begin(9600); + Serial.begin(115200); //Delay to push SETUP button Serial.println("Press setup button"); From 7acc77bcb1102d6e853ee49958a2f2fe2fa74a49 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Fri, 30 Aug 2019 10:48:43 -0500 Subject: [PATCH 37/48] fixing comments for disableipfields --- WiFiManager.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WiFiManager.h b/WiFiManager.h index 9b17f45..c373501 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -340,8 +340,8 @@ class WiFiManager // parameter options int _minimumQuality = -1; // filter wifiscan ap by this rssi - int _staShowStaticFields = 0; // ternary always show static ip fields, only if not set in code, never(cannot change ips via web!) - int _staShowDns = 0; // ternary always show dns, only if not set in code, never(cannot change dns via web!) + int _staShowStaticFields = 0; // ternary 1=always show static ip fields, 0=only if set, -1=never(cannot change ips via web!) + int _staShowDns = 0; // ternary 1=always show dns, 0=only if set, -1=never(cannot change dns via web!) boolean _removeDuplicateAPs = true; // remove dup aps from wifiscan boolean _shouldBreakAfterConfig = false; // stop configportal on save failure boolean _configPortalIsBlocking = true; // configportal enters blocking loop @@ -361,7 +361,7 @@ class WiFiManager // internal options boolean _preloadwifiscan = true; // preload wifiscan if true - boolean _disableIpFields = false; // edge case, if true, showxFields(false) forces ip fields off instead of default show when set + boolean _disableIpFields = false; // modify function of setShow_X_Fields(false), forces ip fields off instead of default show if set, eg. _staShowStaticFields=-1 String _wificountry = ""; // country code, @todo define in strings lang From 999da6d1a17bd864e0732bd878e549dcf11fbe48 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Wed, 11 Sep 2019 12:00:09 -0500 Subject: [PATCH 38/48] fixes #924 wifi info getters gets ssid and psk with persistent param, needs testing --- WiFiManager.cpp | 79 ++++++++++++++++++++++++++++++++++++++++++++----- WiFiManager.h | 8 ++++- 2 files changed, 78 insertions(+), 9 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 55e285f..47862fd 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -2362,9 +2362,29 @@ void WiFiManager::setCountry(String cc){ void WiFiManager::setClass(String str){ _bodyClass = str; } - + // HELPERS +/** + * getWiFiSSID + * @since $dev + * @param bool persistent + * @return String + */ +String WiFiManager::getWiFiSSID(bool persistent){ + return WiFi_SSID(persistent); +} + +/** + * getWiFiPass + * @since $dev + * @param bool persistent + * @return String + */ +String WiFiManager::getWiFiPass(bool persistent){ + return WiFi_psk(persistent); +} + // DEBUG // @todo fix DEBUG_WM(0,0); template @@ -2665,15 +2685,58 @@ bool WiFiManager::WiFi_hasAutoConnect(){ return WiFi_SSID() != ""; } -String WiFiManager::WiFi_SSID(){ - #ifdef ESP8266 - return WiFi.SSID(); - #elif defined(ESP32) - //@todo , workaround only when not connected +String WiFiManager::WiFi_SSID(bool persistent) const{ + + #ifdef ESP8266 + struct station_config conf; + if(persistent) wifi_station_get_config_default(&conf); + else wifi_station_get_config(&conf); + + char tmp[33]; //ssid can be up to 32chars, => plus null term + memcpy(tmp, conf.ssid, sizeof(conf.ssid)); + tmp[32] = 0; //nullterm in case of 32 char ssid + return String(reinterpret_cast(tmp)); + + #elif defined(ESP32) + if(persistent){ + wifi_config_t conf; + esp_wifi_get_config(WIFI_IF_STA, &conf); + return String(reinterpret_cast(conf.sta.ssid)); + } + else { + if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){ + return String(); + } + wifi_ap_record_t info; + if(!esp_wifi_sta_get_ap_info(&info)) { + return String(reinterpret_cast(info.ssid)); + } + return String(); + } + #endif +} + +String WiFiManager::WiFi_psk(bool persistent) const { + #ifdef ESP8266 + struct station_config conf; + + if(persistent) wifi_station_get_config_default(&conf); + else wifi_station_get_config(&conf); + + char tmp[65]; //psk is 64 bytes hex => plus null term + memcpy(tmp, conf.password, sizeof(conf.password)); + tmp[64] = 0; //null term in case of 64 byte psk + return String(reinterpret_cast(tmp)); + + #elif defined(ESP32) + // only if wifi is init + if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){ + return String(); + } wifi_config_t conf; esp_wifi_get_config(WIFI_IF_STA, &conf); - return String(reinterpret_cast(conf.sta.ssid)); - #endif + return String(reinterpret_cast(conf.sta.password)); + #endif } #ifdef ESP32 diff --git a/WiFiManager.h b/WiFiManager.h index c373501..72e4c3a 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -269,6 +269,11 @@ class WiFiManager // check if the module has a saved ap to connect to bool getWiFiIsSaved(); + // helper to get saved ssid, if persistent get stored, else get current if connected + String getWiFiPass(bool persistent = false); + // helper to get saved password, if persistent get stored, else get current if connected + String getWiFiSSID(bool persistent = false); + // debug output the softap config void debugSoftAPConfig(); // debug output platform info and versioning @@ -422,7 +427,8 @@ class WiFiManager uint8_t WiFi_softap_num_stations(); bool WiFi_hasAutoConnect(); void WiFi_autoReconnect(); - String WiFi_SSID(); + String WiFi_SSID(bool persistent = false) const; + String WiFi_psk(bool persistent = false) const; bool WiFi_scanNetworks(); bool WiFi_scanNetworks(bool force,bool async); bool WiFi_scanNetworks(unsigned int cachetime,bool async); From 58428ec1f898f059c98ad40bbf554efa5f205401 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Wed, 11 Sep 2019 12:22:31 -0500 Subject: [PATCH 39/48] fixup some calls I think these should work, will have to test for empty strings and not actual info and fix --- WiFiManager.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 47862fd..41c5fc4 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -785,8 +785,8 @@ bool WiFiManager::wifiConnectNew(String ssid, String pass){ */ bool WiFiManager::wifiConnectDefault(){ bool ret = false; - DEBUG_WM(F("Connecting to saved AP:"),WiFi_SSID()); - DEBUG_WM(DEBUG_DEV,F("Using Password:"),WiFi.psk()); + DEBUG_WM(F("Connecting to saved AP:"),WiFi_SSID(true)); + DEBUG_WM(DEBUG_DEV,F("Using Password:"),WiFi_psk(true)); ret = WiFi_enableSTA(true,storeSTAmode); if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] wifi enableSta failed"); ret = WiFi.begin(); @@ -2682,7 +2682,7 @@ uint8_t WiFiManager::WiFi_softap_num_stations(){ } bool WiFiManager::WiFi_hasAutoConnect(){ - return WiFi_SSID() != ""; + return WiFi_SSID(true) != ""; } String WiFiManager::WiFi_SSID(bool persistent) const{ @@ -2730,8 +2730,8 @@ String WiFiManager::WiFi_psk(bool persistent) const { #elif defined(ESP32) // only if wifi is init - if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){ - return String(); + if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){ + return String(); } wifi_config_t conf; esp_wifi_get_config(WIFI_IF_STA, &conf); From bd8320a45ad444b9748fc39e0d100d320b90e136 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Thu, 12 Sep 2019 09:53:49 -0500 Subject: [PATCH 40/48] fixes #935 disables password ofr open ap selects Only works if htmk class l is not removed and html not changed, js will have to be updated if changed --- extras/WiFiManager.template.html | 9 ++++++++- extras/test.html | 10 ++++++++-- strings_en.h | 9 ++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/extras/WiFiManager.template.html b/extras/WiFiManager.template.html index 657a1e4..74480ee 100644 --- a/extras/WiFiManager.template.html +++ b/extras/WiFiManager.template.html @@ -166,11 +166,18 @@ button.D{ background-color:#dc3630; } +input:disabled { + opacity: 0.5; +} + diff --git a/extras/test.html b/extras/test.html index 1a77214..0789e49 100644 --- a/extras/test.html +++ b/extras/test.html @@ -11,11 +11,12 @@ // preventDefault(); document.getElementById('s').value = l.innerText || l.textContent; // document.location.href = document.location +"#wmform"; - document.getElementById('p').focus(); + p = l.nextElementSibling.classList.contains("l"); + document.getElementById('p').disabled = !p; + if(p)document.getElementById('p').focus(); return false; } - diff --git a/strings_en.h b/strings_en.h index c940467..67389a6 100644 --- a/strings_en.h +++ b/strings_en.h @@ -14,7 +14,13 @@ // !!! THIS DOES NOT WORK, you cannot define in a sketch, if anyone one knows how to order includes to be able to do this help! const char HTTP_HEAD_START[] PROGMEM = "{v}"; -const char HTTP_SCRIPT[] PROGMEM = ""; +const char HTTP_SCRIPT[] PROGMEM = ""; + const char HTTP_HEAD_END[] PROGMEM = "
"; const char HTTP_ROOT_MAIN[] PROGMEM = "

{v}

WiFiManager

"; @@ -86,6 +92,7 @@ const char HTTP_STYLE[] PROGMEM = ""; const char HTTP_HELP[] PROGMEM = From 3f8f3eb1ad70c57ef8d06de1e53d8c226a89d508 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Thu, 12 Sep 2019 09:56:37 -0500 Subject: [PATCH 41/48] fixes #936, adds setWiFiAPChannel --- WiFiManager.cpp | 27 ++++++++++++++++++++------- WiFiManager.h | 4 ++++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 41c5fc4..c1f944f 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -360,30 +360,35 @@ bool WiFiManager::startAP(){ } //@todo add callback here if needed to modify ap but cannot use setAPStaticIPConfig + //@todo rework wifi channelsync as it will work unpredictably when not connected in sta + + int32_t channel = 0; + if(_channelSync) channel = WiFi.channel(); + else channel = _apChannel; - if(_channelSync){ - DEBUG_WM(DEBUG_VERBOSE,"Starting AP on channel:",WiFi.channel()); + if(channel>0){ + DEBUG_WM(DEBUG_VERBOSE,"Starting AP on channel:",channel); } // start soft AP with password or anonymous if (_apPassword != "") { - if(_channelSync){ - ret = WiFi.softAP(_apName.c_str(), _apPassword.c_str(),WiFi.channel()); + if(channel>0){ + ret = WiFi.softAP(_apName.c_str(), _apPassword.c_str(),channel); } else{ ret = WiFi.softAP(_apName.c_str(), _apPassword.c_str());//password option } } else { DEBUG_WM(DEBUG_VERBOSE,F("AP has anonymous access!")); - if(_channelSync){ - ret = WiFi.softAP(_apName.c_str(),"",WiFi.channel()); + if(channel>0){ + ret = WiFi.softAP(_apName.c_str(),"",channel); } else{ ret = WiFi.softAP(_apName.c_str()); } } - if(_debugLevel > DEBUG_DEV) debugSoftAPConfig(); + if(_debugLevel >= DEBUG_DEV) debugSoftAPConfig(); if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] There was a problem starting the AP"); // @todo add softAP retry here @@ -2257,6 +2262,14 @@ bool WiFiManager::setHostname(const char * hostname){ return true; } +/** + * set the soft ao channel, ignored if channelsync is true and connected + * @param int32_t wifi channel, 0 to disable + */ +void WiFiManager::setWiFiAPChannel(int32_t channel){ + _apChannel = channel; +} + /** * toggle showing erase wifi config button on info page * @param boolean enabled diff --git a/WiFiManager.h b/WiFiManager.h index 72e4c3a..18e76ba 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -255,6 +255,9 @@ class WiFiManager bool setHostname(const char * hostname); // show erase wifi onfig button on info page, true void setShowInfoErase(boolean enabled); + // set ap channel + void setWiFiAPChannel(int32_t channel); + // set custom menu // set custom menu items and order @@ -334,6 +337,7 @@ class WiFiManager bool _disableSTA = false; // disable sta when starting ap, always bool _disableSTAConn = true; // disable sta when starting ap, if sta is not connected ( stability ) bool _channelSync = false; // use wifi channel when starting ap + int32_t _apChannel = 0; // channel to use for ap #ifdef ESP32 static uint8_t _lastconxresulttmp; // tmp var for esp32 callback From 646af21d3028f8bc27f703ea47297edb13b51da9 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Thu, 12 Sep 2019 09:56:55 -0500 Subject: [PATCH 42/48] changed dev example non delay --- .../OnDemandConfigPortal/OnDemandConfigPortal.ino | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino b/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino index 55211cc..7c6c959 100644 --- a/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino +++ b/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino @@ -7,6 +7,8 @@ #define TRIGGER_PIN 0 const char* modes[] = { "NULL", "STA", "AP", "STA+AP" }; +unsigned long mtime = 0; + // // #define MYOLED // #include @@ -203,12 +205,13 @@ void loop() { // is configuration portal requested? if ( digitalRead(TRIGGER_PIN) == LOW ) { Serial.println("BUTTON PRESSED"); - wm.setConfigPortalTimeout(120); + wm.setConfigPortalTimeout(140); + wm.setWiFiAPChannel(13); // disable captive portal redirection // wm.setCaptivePortalEnable(false); - if (!wm.startConfigPortal("OnDemandAP")) { + if (!wm.startConfigPortal("OnDemandAP","12345678")) { Serial.println("failed to connect and hit timeout"); delay(3000); } else { @@ -219,9 +222,12 @@ void loop() { } } - if(WiFi.status() == WL_CONNECTED) getTime(); + if(WiFi.status() == WL_CONNECTED && millis()-mtime > 10000 ){ + getTime(); + mtime = millis(); + } // put your main code here, to run repeatedly: - delay(5000); + delay(100); } void getTime() { From f06f4ea5dc893d9ed95ce9c36e6eca618c4a386d Mon Sep 17 00:00:00 2001 From: tablatronix Date: Thu, 12 Sep 2019 09:57:35 -0500 Subject: [PATCH 43/48] adds async cache time _scancachetime adds async flag --- WiFiManager.cpp | 12 +++++++----- WiFiManager.h | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index c1f944f..af78b7a 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -773,7 +773,8 @@ uint8_t WiFiManager::connectWifi(String ssid, String pass) { */ bool WiFiManager::wifiConnectNew(String ssid, String pass){ bool ret = false; - DEBUG_WM(F("Connecting to new AP:"),ssid); + DEBUG_WM(F("CONNECTED:"),WiFi.status() == WL_CONNECTED); + DEBUG_WM(F("Connecting to NEW AP:"),ssid); DEBUG_WM(DEBUG_DEV,F("Using Password:"),pass); WiFi_enableSTA(true,storeSTAmode); // storeSTAmode will also toggle STA on in default opmode (persistent) if true (default) WiFi.persistent(true); @@ -790,7 +791,7 @@ bool WiFiManager::wifiConnectNew(String ssid, String pass){ */ bool WiFiManager::wifiConnectDefault(){ bool ret = false; - DEBUG_WM(F("Connecting to saved AP:"),WiFi_SSID(true)); + DEBUG_WM(F("Connecting to SAVED AP:"),WiFi_SSID(true)); DEBUG_WM(DEBUG_DEV,F("Using Password:"),WiFi_psk(true)); ret = WiFi_enableSTA(true,storeSTAmode); if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] wifi enableSta failed"); @@ -942,7 +943,7 @@ void WiFiManager::handleRoot() { server->sendHeader(FPSTR(HTTP_HEAD_CL), String(page.length())); server->send(200, FPSTR(HTTP_HEAD_CT), page); // server->close(); // testing reliability fix for content length mismatches during mutiple flood hits WiFi_scanNetworks(); // preload wifiscan - if(_preloadwifiscan) WiFi_scanNetworks((unsigned)20000,true); // preload wifiscan throttled, async + if(_preloadwifiscan) WiFi_scanNetworks(_scancachetime,true); // preload wifiscan throttled, async // @todo buggy, captive portals make a query on every page load, causing this to run every time in addition to the real page load // I dont understand why, when you are already in the captive portal, I guess they want to know that its still up and not done or gone // if we can detect these and ignore them that would be great, since they come from the captive portal redirect maybe there is a refferer @@ -1054,7 +1055,7 @@ bool WiFiManager::WiFi_scanNetworks(bool force,bool async){ if(force || _numNetworks == 0 || (millis()-_lastscan > 60000)){ int8_t res; _startscan = millis(); - if(async){ + if(async && _asyncScan){ #ifdef ESP8266 #ifndef WM_NOASYNC // no async available < 2.4.0 DEBUG_WM(DEBUG_VERBOSE,F("WiFi Scan ASYNC started")); @@ -2641,7 +2642,8 @@ bool WiFiManager::WiFi_enableSTA(bool enable,bool persistent) { if(enable) { if(persistent) DEBUG_WM(DEBUG_DEV,F("enableSTA PERSISTENT ON")); return WiFi_Mode(newMode,persistent); - } else { + } + else { return WiFi_Mode(newMode,persistent); } } else { diff --git a/WiFiManager.h b/WiFiManager.h index 18e76ba..fad29d5 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -370,6 +370,8 @@ class WiFiManager // internal options boolean _preloadwifiscan = true; // preload wifiscan if true + boolean _asyncScan = false; + unsigned int _scancachetime = 30000; // ms cache time for background scans boolean _disableIpFields = false; // modify function of setShow_X_Fields(false), forces ip fields off instead of default show if set, eg. _staShowStaticFields=-1 String _wificountry = ""; // country code, @todo define in strings lang From 6e1e698cf990bd1ec5c0b194d884a0c781a77283 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Thu, 12 Sep 2019 09:57:56 -0500 Subject: [PATCH 44/48] comments --- WiFiManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WiFiManager.h b/WiFiManager.h index fad29d5..63205c8 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -336,7 +336,7 @@ class WiFiManager bool _disableSTA = false; // disable sta when starting ap, always bool _disableSTAConn = true; // disable sta when starting ap, if sta is not connected ( stability ) - bool _channelSync = false; // use wifi channel when starting ap + bool _channelSync = false; // use same wifi sta channel when starting ap int32_t _apChannel = 0; // channel to use for ap #ifdef ESP32 From e50d30cd5e3f6ddc84a51581617108bc92560727 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Thu, 12 Sep 2019 14:49:38 -0500 Subject: [PATCH 45/48] uppercase default ap name This should match the default in sdk now --- WiFiManager.cpp | 17 ++++++++++++++--- WiFiManager.h | 3 ++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index af78b7a..c82b96b 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -231,7 +231,7 @@ void WiFiManager::_end(){ // AUTOCONNECT boolean WiFiManager::autoConnect() { - String ssid = _wifissidprefix + "_" + String(WIFI_getChipId(),HEX); + String ssid = getDefaultAPName(); return autoConnect(ssid.c_str(), NULL); } @@ -504,7 +504,7 @@ void WiFiManager::setupConfigPortal() { } boolean WiFiManager::startConfigPortal() { - String ssid = _wifissidprefix + "_" + String(WIFI_getChipId(),HEX); + String ssid = getDefaultAPName(); return startConfigPortal(ssid.c_str(), NULL); } @@ -522,7 +522,10 @@ boolean WiFiManager::startConfigPortal(char const *apName, char const *apPasswo _apName = apName; // @todo check valid apname ? _apPassword = apPassword; - if(_apName == "") _apName = _wifissidprefix + "_" + String(WIFI_getChipId(),HEX); + DEBUG_WM(DEBUG_VERBOSE,F("Starting Config Portal")); + + if(_apName == "") _apName = getDefaultAPName(); + if(!validApPassword()) return false; // HANDLE issues with STA connections, shutdown sta if not connected, or else this will hang channel scanning and softap will not respond @@ -2360,6 +2363,14 @@ bool WiFiManager::getWiFiIsSaved(){ return WiFi_hasAutoConnect(); } +String WiFiManager::getDefaultAPName(){ + String hostString = String(WIFI_getChipId(),HEX); + hostString.toUpperCase(); + // char hostString[16] = {0}; + // sprintf(hostString, "%06X", ESP.getChipId()); + return _wifissidprefix + "_" + hostString; +} + /** * setCountry * @since $dev diff --git a/WiFiManager.h b/WiFiManager.h index 63205c8..b1728b7 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -287,7 +287,8 @@ class WiFiManager void setCountry(String cc); // set body class (invert) void setClass(String str); - + String getDefaultAPName(); + std::unique_ptr dnsServer; #if defined(ESP32) && defined(WM_WEBSERVERSHIM) From 5d9a51f6713e9981850de55d0d37a1f639604f74 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Fri, 13 Sep 2019 11:27:05 -0500 Subject: [PATCH 46/48] adds country support for esp8266 #667 --- WiFiManager.cpp | 23 +++++++++++++++++------ strings_en.h | 25 ++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/WiFiManager.cpp b/WiFiManager.cpp index c82b96b..f3e94d9 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -2451,13 +2451,17 @@ void WiFiManager::DEBUG_WM(wm_debuglevel_t level,Generic text,Genericb textb) { * @return {[type]} [description] */ void WiFiManager::debugSoftAPConfig(){ + wifi_country_t country; + #ifdef ESP8266 softap_config config; wifi_softap_get_config(&config); + wifi_get_country(&country); #elif defined(ESP32) wifi_config_t conf_config; esp_wifi_get_config(WIFI_IF_AP, &conf_config); // == ESP_OK wifi_ap_config_t config = conf_config.ap; + esp_wifi_get_country(&country); #endif DEBUG_WM(F("SoftAP Configuration")); @@ -2469,6 +2473,7 @@ void WiFiManager::debugSoftAPConfig(){ DEBUG_WM(F("authmode: "),config.authmode); DEBUG_WM(F("ssid_hidden: "),config.ssid_hidden); DEBUG_WM(F("max_connection: "),config.max_connection); + DEBUG_WM(F("country: "),(String)country.cc); DEBUG_WM(F("beacon_interval: "),(String)config.beacon_interval + "(ms)"); DEBUG_WM(FPSTR(D_HR)); } @@ -2581,23 +2586,29 @@ String WiFiManager::getModeString(uint8_t mode){ } bool WiFiManager::WiFiSetCountry(){ + if(_wificountry == "") return false; // skip not set bool ret = false; #ifdef ESP32 - // @todo check if wifi is init, no idea how, doesnt seem to be exposed - if(_wificountry == "") return ret; // skip not set - else if(WiFi.getMode() == WIFI_MODE_NULL); // exception if wifi not init! + // @todo check if wifi is init, no idea how, doesnt seem to be exposed atm ( might be now! ) + if(WiFi.getMode() == WIFI_MODE_NULL); // exception if wifi not init! else if(_wificountry == "US") ret = esp_wifi_set_country(&WM_COUNTRY_US) == ESP_OK; else if(_wificountry == "JP") ret = esp_wifi_set_country(&WM_COUNTRY_JP) == ESP_OK; else if(_wificountry == "CN") ret = esp_wifi_set_country(&WM_COUNTRY_CN) == ESP_OK; else DEBUG_WM(DEBUG_ERROR,"[ERROR] country code not found"); - if(ret) DEBUG_WM(DEBUG_VERBOSE,"esp_wifi_set_country: " + _wificountry); - else DEBUG_WM(DEBUG_ERROR,"[ERROR] esp_wifi_set_country failed"); + #elif defined(ESP8266) + // if(WiFi.getMode() == WIFI_OFF); // exception if wifi not init! + if(_wificountry == "US") ret = wifi_set_country(&WM_COUNTRY_US); + else if(_wificountry == "JP") ret = wifi_set_country(&WM_COUNTRY_JP); + else if(_wificountry == "CN") ret = wifi_set_country(&WM_COUNTRY_CN); + else DEBUG_WM(DEBUG_ERROR,"[ERROR] country code not found"); #endif + + if(ret) DEBUG_WM(DEBUG_VERBOSE,"esp_wifi_set_country: " + _wificountry); + else DEBUG_WM(DEBUG_ERROR,"[ERROR] esp_wifi_set_country failed"); return ret; } - // set mode ignores WiFi.persistent bool WiFiManager::WiFi_Mode(WiFiMode_t m,bool persistent) { bool ret; diff --git a/strings_en.h b/strings_en.h index 67389a6..a68f225 100644 --- a/strings_en.h +++ b/strings_en.h @@ -330,8 +330,27 @@ const char * const AUTH_MODE_NAMES[] PROGMEM const char* const WIFI_MODES[] PROGMEM = { "NULL", "STA", "AP", "STA+AP" }; + #ifdef ESP32 -const wifi_country_t WM_COUNTRY_US{"US",1,11,WIFI_COUNTRY_POLICY_AUTO}; -const wifi_country_t WM_COUNTRY_CN{"CN",1,13,WIFI_COUNTRY_POLICY_AUTO}; -const wifi_country_t WM_COUNTRY_JP{"JP",1,14,WIFI_COUNTRY_POLICY_AUTO}; +// as 2.5.2 +// typedef struct { +// char cc[3]; /**< country code string */ +// uint8_t schan; /**< start channel */ +// uint8_t nchan; /**< total channel number */ +// int8_t max_tx_power; /**< This field is used for getting WiFi maximum transmitting power, call esp_wifi_set_max_tx_power to set the maximum transmitting power. */ +// wifi_country_policy_t policy; /**< country policy */ +// } wifi_country_t; +const wifi_country_t WM_COUNTRY_US{"US",1,11,CONFIG_ESP32_PHY_MAX_TX_POWER,WIFI_COUNTRY_POLICY_AUTO}; +const wifi_country_t WM_COUNTRY_CN{"CN",1,13,CONFIG_ESP32_PHY_MAX_TX_POWER,WIFI_COUNTRY_POLICY_AUTO}; +const wifi_country_t WM_COUNTRY_JP{"JP",1,14,CONFIG_ESP32_PHY_MAX_TX_POWER,WIFI_COUNTRY_POLICY_AUTO}; +#elif defined(ESP8266) +// typedef struct { +// char cc[3]; /**< country code string */ +// uint8_t schan; /**< start channel */ +// uint8_t nchan; /**< total channel number */ +// uint8_t policy; /**< country policy */ +// } wifi_country_t; +static wifi_country_t WM_COUNTRY_US{"US",1,11,WIFI_COUNTRY_POLICY_AUTO}; +static wifi_country_t WM_COUNTRY_CN{"CN",1,13,WIFI_COUNTRY_POLICY_AUTO}; +static wifi_country_t WM_COUNTRY_JP{"JP",1,14,WIFI_COUNTRY_POLICY_AUTO}; #endif From 4d94476fa3d69bb3756ddaee5dd4f10091e69e41 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Fri, 13 Sep 2019 11:27:20 -0500 Subject: [PATCH 47/48] add string guards --- strings_en.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/strings_en.h b/strings_en.h index a68f225..1d17d90 100644 --- a/strings_en.h +++ b/strings_en.h @@ -10,6 +10,9 @@ * @license MIT */ +#ifndef _WM_STRINGS_H_ +#define _WM_STRINGS_H_ + #ifndef WIFI_MANAGER_OVERRIDE_STRINGS // !!! THIS DOES NOT WORK, you cannot define in a sketch, if anyone one knows how to order includes to be able to do this help! @@ -354,3 +357,5 @@ static wifi_country_t WM_COUNTRY_US{"US",1,11,WIFI_COUNTRY_POLICY_AUTO}; static wifi_country_t WM_COUNTRY_CN{"CN",1,13,WIFI_COUNTRY_POLICY_AUTO}; static wifi_country_t WM_COUNTRY_JP{"JP",1,14,WIFI_COUNTRY_POLICY_AUTO}; #endif + +#endif \ No newline at end of file From 3771a79a55e3255db12d2e9dfdc4a4c8f244a493 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Fri, 13 Sep 2019 11:28:05 -0500 Subject: [PATCH 48/48] dev example country and bounce --- .../OnDemandConfigPortal.ino | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino b/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino index 7c6c959..3044d8a 100644 --- a/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino +++ b/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino @@ -1,5 +1,7 @@ /** * This is a kind of unit test for DEV for now + * It contains many of the public methods + * */ #include // https://github.com/tzapu/WiFiManager #include @@ -167,14 +169,13 @@ void setup() { // wm.setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0)); // wm.setAPStaticIPConfig(IPAddress(10,0,1,99), IPAddress(10,0,1,1), IPAddress(255,255,255,0)); - // WiFi.mode(WIFI_STA); - // const wifi_country_t COUNTRY_US{"US",1,11,WIFI_COUNTRY_POLICY_AUTO}; - // const wifi_country_t COUNTRY_CN{"CN",1,13,WIFI_COUNTRY_POLICY_AUTO}; - // const wifi_country_t COUNTRY_JP{"JP",1,14,WIFI_COUNTRY_POLICY_AUTO}; - // esp_wifi_set_country(&COUNTRY_US); - - // wm.setCountry("US"); + // set country + wm.setCountry("US"); // setting wifi country seems to improve OSX soft ap connectivity, may help others as well + // set channel + wm.setWiFiAPChannel(13); + + // set configrportal timeout wm.setConfigPortalTimeout(120); // wm.startConfigPortal("AutoConnectAP", "password"); @@ -189,6 +190,8 @@ void setup() { print_oled("Not Connected",2); } else if(TEST_CP) { + delay(1000); + Serial.println("TEST_CP ENABLED"); // start configportal always wm.setConfigPortalTimeout(60); wm.startConfigPortal(); @@ -204,17 +207,20 @@ void setup() { void loop() { // is configuration portal requested? if ( digitalRead(TRIGGER_PIN) == LOW ) { - Serial.println("BUTTON PRESSED"); - wm.setConfigPortalTimeout(140); - wm.setWiFiAPChannel(13); + delay(100); + if ( digitalRead(TRIGGER_PIN) == LOW ){ + Serial.println("BUTTON PRESSED"); + wm.setConfigPortalTimeout(140); - // disable captive portal redirection - // wm.setCaptivePortalEnable(false); - - if (!wm.startConfigPortal("OnDemandAP","12345678")) { - Serial.println("failed to connect and hit timeout"); - delay(3000); - } else { + // disable captive portal redirection + // wm.setCaptivePortalEnable(false); + + if (!wm.startConfigPortal("OnDemandAP","12345678")) { + Serial.println("failed to connect and hit timeout"); + delay(3000); + } + } + else { //if you get here you have connected to the WiFi Serial.println("connected...yeey :)"); print_oled("Connected\nIP: " + WiFi.localIP().toString() + "\nSSID: " + WiFi.SSID(),1);