Skip to content

Commit 768bb7a

Browse files
wifi manual reconnect fix
1 parent b75e271 commit 768bb7a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

EmbUI/wi-fi.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ void EmbUI::wifi_connect(const char *ssid, const char *pwd)
174174
if (ssid){
175175
String _ssid(ssid); String _pwd(pwd); // I need objects to pass it to the lambda
176176
embuischedw.once(WIFI_BEGIN_DELAY, [_ssid, _pwd, this](){
177+
WiFi.disconnect();
177178
LOG(printf_P, PSTR("UI WiFi: client connecting to SSID:%s, pwd:%s\n"), _ssid.c_str(), _pwd.c_str());
178179
#ifdef ESP32
179180
WiFi.disconnect();
@@ -183,7 +184,7 @@ void EmbUI::wifi_connect(const char *ssid, const char *pwd)
183184
embuischedw.detach();
184185
});
185186
} else {
186-
embuischedw.once(WIFI_BEGIN_DELAY, [this](){ WiFi.begin(); embuischedw.detach();} );
187+
embuischedw.once(WIFI_BEGIN_DELAY, [this](){ WiFi.disconnect(); sysData.wifi_sta = false; WiFi.begin(); embuischedw.detach();} );
187188
}
188189
}
189190

0 commit comments

Comments
 (0)