Fixes WiFi stability issue

WiFi sometimes fails and cannot reconnect without a sleep cycle. To fix this, we can fully disconnect from the WiFi connection before our reconnection attempt
This commit is contained in:
mcurtiss1992 2024-03-07 14:43:14 -06:00
parent a8265c9580
commit d2322083aa

View file

@ -27,6 +27,7 @@ void WiFiEvent(WiFiEvent_t event){
if (WifiLabel != NULL) {lv_label_set_text(WifiLabel, "");}
// automatically try to reconnect
Serial.printf("WiFi got disconnected. Will try to reconnect.\r\n");
WiFi.disconnect();
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
} else {