From 944450840aa7fd33a7c98082d70aef2567d8f6a8 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Thu, 20 Dec 2018 10:56:55 -0600 Subject: [PATCH 1/5] 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 2/5] 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 3/5] 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 4/5] 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 3717e323b9f524c4018cc883350db8072b5d3ff3 Mon Sep 17 00:00:00 2001 From: tablatronix Date: Thu, 10 Jan 2019 15:37:12 -0600 Subject: [PATCH 5/5] 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();