From 7384455fb9b1f428a352cd5c84a180ae14fc9b1b Mon Sep 17 00:00:00 2001 From: Florian <1technophile@users.noreply.github.com> Date: Sat, 7 Dec 2019 13:45:10 +0100 Subject: [PATCH] Improve Wifi automatic reconnect for ESP32 (#504) * do not launch a ble scan if mqtt client is disconnected * add wifi.begin when disconnected https://github.com/espressif/arduino-esp32/issues/2501 --- main/main.ino | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main/main.ino b/main/main.ino index 25e5bab..92675f0 100644 --- a/main/main.ino +++ b/main/main.ino @@ -475,7 +475,11 @@ void reconnect() { } trc(F("failed, rc=")); trc(client.state()); - delay(10000); + delay(5000); + // On ESP32 force wifi begin https://github.com/espressif/arduino-esp32/issues/2501 + #if defined(ESP32) + WiFi.begin(); + #endif } } }