attempt to fix not connecting issues and endless loops

This commit is contained in:
Alex Tudorache
2016-03-08 07:46:06 +02:00
parent b99487785d
commit 566bcbe063
2 changed files with 16 additions and 5 deletions
+13 -4
View File
@@ -151,8 +151,8 @@ boolean WiFiManager::autoConnect(char const *apName, char const *apPassword) {
boolean WiFiManager::startConfigPortal(char const *apName, char const *apPassword) {
//setup AP
WiFi.mode(WIFI_AP);
DEBUG_WM("SET AP");
WiFi.mode(WIFI_AP_STA);
DEBUG_WM("SET AP STA");
_apName = apName;
_apPassword = apPassword;
@@ -229,8 +229,17 @@ int WiFiManager::connectWifi(String ssid, String pass) {
if (ssid != "") {
WiFi.begin(ssid.c_str(), pass.c_str());
} else {
DEBUG_WM("Using last saved values, should be faster");
WiFi.begin();
if(WiFi.SSID()) {
DEBUG_WM("Using last saved values, should be faster");
//trying to fix connection in progress hanging
ETS_UART_INTR_DISABLE();
wifi_station_disconnect();
ETS_UART_INTR_ENABLE();
WiFi.begin();
} else {
DEBUG_WM("No saved credentials");
}
}
int connRes = waitForConnectResult();
+3 -1
View File
@@ -20,7 +20,9 @@
#undef min
#undef max
#include <algorithm>
extern "C" {
#include "user_interface.h"
}
const char HTTP_200[] PROGMEM = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n";
const char HTTP_HEAD[] PROGMEM = "<!DOCTYPE html><html lang=\"en\"><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\"/><title>{v}</title>";