From 845ca37c761445d7db5f72439ff6234bbfb54bd6 Mon Sep 17 00:00:00 2001 From: Joe Tretter Date: Sat, 9 Sep 2023 14:41:31 -0500 Subject: [PATCH] Reconnect Wifi after lost conneciton --- src/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 6297384..825defd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -95,7 +95,13 @@ void setup() { } void loop() { - if (!client.connected()) { + if (WiFi.status() != WL_CONNECTED) { + WiFi.disconnect(); + delay(1000); + setup_wifi(); + } + + if ((WiFi.status() == WL_CONNECTED)&&(!client.connected())) { reconnect(); } client.loop();