From 43c1f2b032f1c7a4b13e0f8189692db94f6e0140 Mon Sep 17 00:00:00 2001 From: rmadurawe13 Date: Mon, 14 Nov 2022 15:42:22 +0530 Subject: [PATCH 1/2] Updated Azure_IoT_Central_ESP32.ino bug fix When the ESP32 disconnects from WiFi and then reconnects, it gets stuck in an infinite azure reconnecting loop --- .../Azure_IoT_Central_ESP32/Azure_IoT_Central_ESP32.ino | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/Azure_IoT_Central_ESP32/Azure_IoT_Central_ESP32.ino b/examples/Azure_IoT_Central_ESP32/Azure_IoT_Central_ESP32.ino index 7413ac95..23254057 100644 --- a/examples/Azure_IoT_Central_ESP32/Azure_IoT_Central_ESP32.ino +++ b/examples/Azure_IoT_Central_ESP32/Azure_IoT_Central_ESP32.ino @@ -406,8 +406,8 @@ void loop() { if (WiFi.status() != WL_CONNECTED) { + azure_iot_stop(&azure_iot); connect_to_wifi(); - azure_iot_start(&azure_iot); } else { @@ -428,7 +428,9 @@ void loop() case azure_iot_error: LogError("Azure IoT client is in error state."); azure_iot_stop(&azure_iot); - WiFi.disconnect(); + break; + case azure_iot_disconnected: + azure_iot_start(&azure_iot); break; default: break; From 960ca85331883a2d1b163e8e0d84c6cb0e28db64 Mon Sep 17 00:00:00 2001 From: Ravin Madurawe Date: Tue, 15 Nov 2022 22:32:14 +0530 Subject: [PATCH 2/2] Applied bug fix to Azure_IoT_Central_ESP32_AzureIoTKit.ino The bug fix that was previously applied to the Azure_IoT_Central_ESP32.ino file where the connecting process to Azure IoT Central gets stuck in an infinite connecting-disconnecting loop after the WiFi is restarted, has now been applied to the Azure_IoT_Central_ESP32_AzureIoTKit.ino example file. --- .../Azure_IoT_Central_ESP32_AzureIoTKit.ino | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/Azure_IoT_Central_ESP32_AzureIoTKit/Azure_IoT_Central_ESP32_AzureIoTKit.ino b/examples/Azure_IoT_Central_ESP32_AzureIoTKit/Azure_IoT_Central_ESP32_AzureIoTKit.ino index b2459c4a..0105f013 100644 --- a/examples/Azure_IoT_Central_ESP32_AzureIoTKit/Azure_IoT_Central_ESP32_AzureIoTKit.ino +++ b/examples/Azure_IoT_Central_ESP32_AzureIoTKit/Azure_IoT_Central_ESP32_AzureIoTKit.ino @@ -410,8 +410,8 @@ void loop() { if (WiFi.status() != WL_CONNECTED) { + azure_iot_stop(&azure_iot); connect_to_wifi(); - azure_iot_start(&azure_iot); } else { @@ -432,7 +432,9 @@ void loop() case azure_iot_error: LogError("Azure IoT client is in error state."); azure_iot_stop(&azure_iot); - WiFi.disconnect(); + break; + case azure_iot_disconnected: + azure_iot_start(&azure_iot); break; default: break;