diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 1ecc949..4a90985 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -1446,6 +1446,7 @@ void WiFiManager::handleInfo() { uint16_t infos = 0; //@todo convert to enum or refactor to strings + //@todo wrap in build flag to remove all info code for memory saving #ifdef ESP8266 infos = 27; String infoids[] = { @@ -1524,7 +1525,7 @@ void WiFiManager::handleInfo() { String WiFiManager::getInfoData(String id){ String p; - // @todo add versioning + // @todo add WM versioning if(id==F("esphead"))p = FPSTR(HTTP_INFO_esphead); else if(id==F("wifihead"))p = FPSTR(HTTP_INFO_wifihead); else if(id==F("uptime")){ diff --git a/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino b/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino index 34c4d75..44525f7 100644 --- a/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino +++ b/examples/DEV/OnDemandConfigPortal/OnDemandConfigPortal.ino @@ -72,6 +72,7 @@ WiFiManager wm; // OPTION FLAGS bool TEST_CP = true; // always start the configportal, even if ap found bool TEST_NET = true; // do a network test after connect, (gets ntp time) +bool ALLOWONDEMAND = false; // char ssid[] = "*************"; // your network SSID (name) // char pass[] = "********"; // your network password @@ -208,7 +209,7 @@ void setup() { //if it does not connect it starts an access point with the specified name //here "AutoConnectAP" //and goes into a blocking loop awaiting configuration - + wifiInfo(); print_oled(F("Connecting..."),2); if(!wm.autoConnect("WM_AutoConnectAP")) { Serial.println("failed to connect and hit timeout"); @@ -226,6 +227,8 @@ void setup() { Serial.println("connected...yeey :)"); print_oled("Connected\nIP: " + WiFi.localIP().toString() + "\nSSID: " + WiFi.SSID(),1); } + + wifiInfo(); pinMode(TRIGGER_PIN, INPUT); #ifdef USEOTA @@ -233,13 +236,20 @@ void setup() { #endif } +void wifiInfo(){ + WiFi.printDiag(Serial); + Serial.println("SAVED: " + (String)wm.getWiFiIsSaved() ? "YES" : "NO"); + Serial.println("SSID: " + (String)wm.getWiFiSSID()); + Serial.println("PASS: " + (String)wm.getWiFiPass()); +} + void loop() { #ifdef USEOTA ArduinoOTA.handle(); #endif // is configuration portal requested? - if ( digitalRead(TRIGGER_PIN) == LOW ) { + if (ALLOWONDEMAND && digitalRead(TRIGGER_PIN) == LOW ) { delay(100); if ( digitalRead(TRIGGER_PIN) == LOW ){ Serial.println("BUTTON PRESSED");