diff --git a/src/NetworkSettings.cpp b/src/NetworkSettings.cpp index d4857ae..e43c69c 100644 --- a/src/NetworkSettings.cpp +++ b/src/NetworkSettings.cpp @@ -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);