Fix AP not opening

This commit is contained in:
iranl
2024-11-22 12:33:38 +01:00
parent c8eb1cd41a
commit add5e37563
2 changed files with 19 additions and 17 deletions

View File

@@ -63,16 +63,7 @@ void WifiDevice::initialize()
String(F(" and channel: ")) + String(WiFi.channel(i)));
}
if ((_connectOnScanDone && _foundNetworks > 0) || _preferences->getBool(preference_find_best_rssi, false))
{
connect();
}
else if (_connectOnScanDone)
{
Log->println("No networks found, restarting scan");
scan(false, true);
}
else if (_openAP)
if (_openAP)
{
openAP();
}
@@ -127,6 +118,15 @@ void WifiDevice::initialize()
return;
}
}
else if ((_connectOnScanDone && _foundNetworks > 0) || _preferences->getBool(preference_find_best_rssi, false))
{
connect();
}
else if (_connectOnScanDone)
{
Log->println("No networks found, restarting scan");
scan(false, true);
}
}
});
@@ -190,14 +190,16 @@ void WifiDevice::openAP()
{
if(_startAP)
{
WiFi.mode(WIFI_AP_STA);
WiFi.softAPsetHostname(_hostname.c_str());
WiFi.softAP("NukiHub", "NukiHubESP32");
_startAP = false;
WiFi.mode(WIFI_AP);
delay(500);
WiFi.softAPsetHostname(_hostname.c_str());
delay(500);
WiFi.softAP("NukiHub", "NukiHubESP32");
if(MDNS.begin(_hostname.c_str())){
MDNS.addService("http", "tcp", 80);
}
//if(MDNS.begin(_hostname.c_str())){
// MDNS.addService("http", "tcp", 80);
//}
}
}