mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-16 16:01:36 +10:00
Merge branch 'development' of https://github.com/tzapu/WiFiManager into development
This commit is contained in:
+23
-2
@@ -272,6 +272,15 @@ bool WiFiManager::startAP(){
|
||||
WiFi.softAPConfig(_ap_static_ip, _ap_static_gw, _ap_static_sn);
|
||||
}
|
||||
|
||||
#ifdef ESP8266
|
||||
// @bug workaround for bug #4372 https://github.com/esp8266/Arduino/issues/4372
|
||||
if(!WiFi.enableAP(true)) {
|
||||
DEBUG_WM("enableAP failed!");
|
||||
return false;
|
||||
}
|
||||
delay(500);
|
||||
#endif
|
||||
|
||||
// start soft AP with password or anonymous
|
||||
if (_apPassword != "") {
|
||||
ret = WiFi.softAP(_apName.c_str(), _apPassword.c_str());//password option
|
||||
@@ -283,7 +292,8 @@ bool WiFiManager::startAP(){
|
||||
if(_debugLevel > DEBUG_DEV) debugSoftAPConfig();
|
||||
|
||||
if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] There was a problem starting the AP");
|
||||
|
||||
// @tood add softAP retry here
|
||||
|
||||
delay(500); // slight delay to make sure we get an AP IP
|
||||
DEBUG_WM(F("AP IP address:"),WiFi.softAPIP());
|
||||
|
||||
@@ -382,7 +392,7 @@ void WiFiManager::setupConfigPortal() {
|
||||
server->on((String)FPSTR(R_paramsave), std::bind(&WiFiManager::handleParamSave, this));
|
||||
server->on((String)FPSTR(R_restart), std::bind(&WiFiManager::handleReset, this));
|
||||
server->on((String)FPSTR(R_exit), std::bind(&WiFiManager::handleExit, this));
|
||||
server->on((String)FPSTR(R_close), std::bind(&WiFiManager::stopCaptivePortal, this));
|
||||
server->on((String)FPSTR(R_close), std::bind(&WiFiManager::handleClose, this));
|
||||
server->on((String)FPSTR(R_erase), std::bind(&WiFiManager::handleErase, this));
|
||||
server->on((String)FPSTR(R_status), std::bind(&WiFiManager::handleWiFiStatus, this));
|
||||
//server->on("/fwlink", std::bind(&WiFiManager::handleRoot, this)); //Microsoft captive portal. Maybe not needed. Might be handled by notFound handler.
|
||||
@@ -1510,6 +1520,17 @@ boolean WiFiManager::captivePortal() {
|
||||
|
||||
void WiFiManager::stopCaptivePortal(){
|
||||
_enableCaptivePortal= false;
|
||||
// @todo maybe disable configportaltimeout(optional), or just provide callback for user
|
||||
}
|
||||
|
||||
void WiFiManager::handleClose(){
|
||||
stopCaptivePortal();
|
||||
DEBUG_WM(DEBUG_VERBOSE,F("<- HTTP close"));
|
||||
handleRequest();
|
||||
String page = getHTTPHead(FPSTR(S_titleclose)); // @token titleclose
|
||||
page += FPSTR(S_closing); // @token closing
|
||||
server->sendHeader(FPSTR(HTTP_HEAD_CL), String(page.length()));
|
||||
server->send(200, FPSTR(HTTP_HEAD_CT), page);
|
||||
}
|
||||
|
||||
void WiFiManager::reportStatus(String &page){
|
||||
|
||||
Reference in New Issue
Block a user