From d1374becc468b9029dd00491aef1f20299770be1 Mon Sep 17 00:00:00 2001 From: Epiller Date: Tue, 3 Dec 2019 18:03:22 +0100 Subject: [PATCH] Added delay when checking if device was successfully disconnected from WiFi to avoid crashes --- src/ATT_ESP8266.h | 4 +++- src/ATT_MKR1010.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ATT_ESP8266.h b/src/ATT_ESP8266.h index a0bcb03..0809d50 100644 --- a/src/ATT_ESP8266.h +++ b/src/ATT_ESP8266.h @@ -307,7 +307,9 @@ void Device::disconnectWiFi() { disconnectAllThingsTalk(); WiFi.disconnect(); disconnectedWiFi = true; - while (WiFi.status() == WL_CONNECTED) {} + while (WiFi.status() == WL_CONNECTED) { + delay(1000); + } debug("Successfully Disconnected from WiFi"); } } diff --git a/src/ATT_MKR1010.h b/src/ATT_MKR1010.h index 6a30ecb..005f2ed 100644 --- a/src/ATT_MKR1010.h +++ b/src/ATT_MKR1010.h @@ -364,7 +364,9 @@ void Device::disconnectWiFi() { disconnectAllThingsTalk(); WiFi.disconnect(); disconnectedWiFi = true; - while (WiFi.status() == WL_CONNECTED) {} + while (WiFi.status() == WL_CONNECTED) { + delay(1000); + } debug("Successfully Disconnected from WiFi"); } }