Fix: Set WiFi setScanMethod and setSortMethod also on first connect

This commit is contained in:
Thomas Basler 2023-07-20 23:44:09 +02:00
parent 3b02ffe7a8
commit 9dbeec3a31

View File

@ -21,6 +21,9 @@ void NetworkSettingsClass::init()
{
using std::placeholders::_1;
WiFi.setScanMethod(WIFI_ALL_CHANNEL_SCAN);
WiFi.setSortMethod(WIFI_CONNECT_AP_BY_SIGNAL);
WiFi.onEvent(std::bind(&NetworkSettingsClass::NetworkEvent, this, _1));
setupMode();
}
@ -121,8 +124,6 @@ void NetworkSettingsClass::setupMode()
dnsServer->stop();
dnsServerStatus = false;
if (_networkMode == network_mode::WiFi) {
WiFi.setScanMethod(WIFI_ALL_CHANNEL_SCAN);
WiFi.setSortMethod(WIFI_CONNECT_AP_BY_SIGNAL);
WiFi.mode(WIFI_STA);
} else {
WiFi.mode(WIFI_MODE_NULL);