mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-04 02:48:13 +10:00
Merge commit '90bac5d5803dec56b53dbb396acf0fb94cfac591'
Conflicts: examples/OnDemandConfigPortal/OnDemandConfigPortal.ino
This commit is contained in:
+7
-11
@@ -49,11 +49,13 @@ void WiFiManager::addParameter(WiFiManagerParameter *p) {
|
||||
DEBUG_WM(p->getID());
|
||||
}
|
||||
|
||||
void WiFiManager::setupConfigPortal() {
|
||||
void WiFiManager::setupConfigPortal(char const *apName, char const *apPassword) {
|
||||
dnsServer.reset(new DNSServer());
|
||||
server.reset(new ESP8266WebServer(80));
|
||||
|
||||
DEBUG_WM(F(""));
|
||||
_apName = apName;
|
||||
_apPassword = apPassword;
|
||||
start = millis();
|
||||
|
||||
DEBUG_WM(F("Configuring access point... "));
|
||||
@@ -128,17 +130,14 @@ boolean WiFiManager::startConfigPortal(char const *apName, char const *apPasswo
|
||||
//setup AP
|
||||
WiFi.mode(WIFI_AP);
|
||||
|
||||
_apName = apName;
|
||||
_apPassword = apPassword;
|
||||
|
||||
//notify we entered AP mode
|
||||
if ( _apcallback != NULL) {
|
||||
_apcallback();
|
||||
}
|
||||
|
||||
connect = false;
|
||||
setupConfigPortal();
|
||||
DEBUG_WM("start loop");
|
||||
setupConfigPortal(apName, apPassword);
|
||||
|
||||
while (timeout == 0 || millis() < start + timeout) {
|
||||
//DNS
|
||||
dnsServer->processNextRequest();
|
||||
@@ -170,7 +169,7 @@ boolean WiFiManager::startConfigPortal(char const *apName, char const *apPasswo
|
||||
|
||||
server.reset();
|
||||
dnsServer.reset();
|
||||
DEBUG_WM("end loop");
|
||||
|
||||
return WiFi.status() == WL_CONNECTED;
|
||||
}
|
||||
|
||||
@@ -206,10 +205,6 @@ String WiFiManager::getPassword() {
|
||||
return _pass;
|
||||
}
|
||||
|
||||
String WiFiManager::getConfigPortalSSID() {
|
||||
return _apName;
|
||||
}
|
||||
|
||||
String WiFiManager::urldecode(const char *src)
|
||||
{
|
||||
String decoded = "";
|
||||
@@ -482,6 +477,7 @@ void WiFiManager::DEBUG_WM(Generic text) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int WiFiManager::getRSSIasQuality(int RSSI) {
|
||||
int quality = 0;
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@ void loop() {
|
||||
//here "AutoConnectAP"
|
||||
//and goes into a blocking loop awaiting configuration
|
||||
|
||||
//WITHOUT THIS THE AP DOES NOT SEEM TO WORK PROPERLY
|
||||
WiFi.mode(WIFI_STA);
|
||||
//WITHOUT THIS THE AP DOES NOT SEEM TO WORK PROPERLY WITH SDK 1.5 , update to at least 1.5.1
|
||||
//WiFi.mode(WIFI_STA);
|
||||
|
||||
if (!wifiManager.startConfigPortal("OnDemandAP")) {
|
||||
Serial.println("failed to connect and hit timeout");
|
||||
|
||||
Reference in New Issue
Block a user