mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-09-14 22:24:07 +00:00
prevent STA warning on boot
This commit is contained in:
@@ -82,7 +82,13 @@ void Network::begin() {
|
||||
WiFi.persistent(false);
|
||||
WiFi.setAutoReconnect(false);
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.disconnect(true, true); // wipe old settings in NVS. Will give a warning on boot but can be ignored.
|
||||
|
||||
if (WiFi.STA.started()) {
|
||||
WiFi.disconnect(true, true); // wipe old settings; only when STA is up
|
||||
} else {
|
||||
WiFi.disconnect(true, false); // disconnect/off without erase, so no warning is shown
|
||||
}
|
||||
|
||||
WiFi.setScanMethod(WIFI_ALL_CHANNEL_SCAN);
|
||||
WiFi.setHostname(hostname_.c_str()); // updates shared default_hostname buffer
|
||||
WiFi.enableSTA(true); // creates the STA netif
|
||||
|
||||
Reference in New Issue
Block a user