Not tested, not sure if captive portal works with hidden ap, test please.
adds wm.setWiFiAPHidden(bool);
This commit is contained in:
tablatronix
2019-10-30 08:55:24 -05:00
parent 4014daeb71
commit a2355889ba
3 changed files with 20 additions and 5 deletions
+14 -4
View File
@@ -371,20 +371,21 @@ bool WiFiManager::startAP(){
}
// start soft AP with password or anonymous
// default channel is 1 here and in esplib, @todo just change to default remove conditionals
if (_apPassword != "") {
if(channel>0){
ret = WiFi.softAP(_apName.c_str(), _apPassword.c_str(),channel);
ret = WiFi.softAP(_apName.c_str(), _apPassword.c_str(),channel,_apHidden);
}
else{
ret = WiFi.softAP(_apName.c_str(), _apPassword.c_str());//password option
ret = WiFi.softAP(_apName.c_str(), _apPassword.c_str(),1,_apHidden);//password option
}
} else {
DEBUG_WM(DEBUG_VERBOSE,F("AP has anonymous access!"));
if(channel>0){
ret = WiFi.softAP(_apName.c_str(),"",channel);
ret = WiFi.softAP(_apName.c_str(),"",channel,_apHidden);
}
else{
ret = WiFi.softAP(_apName.c_str());
ret = WiFi.softAP(_apName.c_str(),"",1,_apHidden);
}
}
@@ -2285,6 +2286,15 @@ void WiFiManager::setWiFiAPChannel(int32_t channel){
_apChannel = channel;
}
/**
* set the soft ap hidden
* @param bool wifi ap hidden, default is false
*/
void WiFiManager::setWiFiAPHidden(bool hidden){
_apHidden = hidden;
}
/**
* toggle showing erase wifi config button on info page
* @param boolean enabled
+3 -1
View File
@@ -257,7 +257,8 @@ class WiFiManager
void setShowInfoErase(boolean enabled);
// set ap channel
void setWiFiAPChannel(int32_t channel);
// set ap hidden
void setWiFiAPHidden(bool hidden); // default false
// set custom menu
// set custom menu items and order
@@ -339,6 +340,7 @@ class WiFiManager
bool _disableSTAConn = true; // disable sta when starting ap, if sta is not connected ( stability )
bool _channelSync = false; // use same wifi sta channel when starting ap
int32_t _apChannel = 0; // channel to use for ap
bool _apHidden = false; // store softap hidden value
#ifdef ESP32
static uint8_t _lastconxresulttmp; // tmp var for esp32 callback
@@ -175,6 +175,9 @@ void setup() {
// set channel
wm.setWiFiAPChannel(13);
// set AP hidden
// wm.setAPHidden(true);
// set configrportal timeout
wm.setConfigPortalTimeout(120);
// wm.startConfigPortal("AutoConnectAP", "password");