Skip to content

Commit 0c2e414

Browse files
authored
Updated Azure_IoT_Central_ESP32.ino bug fix (#43)
1 parent 517139d commit 0c2e414

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

examples/Azure_IoT_Central_ESP32/Azure_IoT_Central_ESP32.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ void loop()
406406
{
407407
if (WiFi.status() != WL_CONNECTED)
408408
{
409+
azure_iot_stop(&azure_iot);
409410
connect_to_wifi();
410-
azure_iot_start(&azure_iot);
411411
}
412412
else
413413
{
@@ -428,7 +428,9 @@ void loop()
428428
case azure_iot_error:
429429
LogError("Azure IoT client is in error state.");
430430
azure_iot_stop(&azure_iot);
431-
WiFi.disconnect();
431+
break;
432+
case azure_iot_disconnected:
433+
azure_iot_start(&azure_iot);
432434
break;
433435
default:
434436
break;

examples/Azure_IoT_Central_ESP32_AzureIoTKit/Azure_IoT_Central_ESP32_AzureIoTKit.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,8 @@ void loop()
410410
{
411411
if (WiFi.status() != WL_CONNECTED)
412412
{
413+
azure_iot_stop(&azure_iot);
413414
connect_to_wifi();
414-
azure_iot_start(&azure_iot);
415415
}
416416
else
417417
{
@@ -432,7 +432,9 @@ void loop()
432432
case azure_iot_error:
433433
LogError("Azure IoT client is in error state.");
434434
azure_iot_stop(&azure_iot);
435-
WiFi.disconnect();
435+
break;
436+
case azure_iot_disconnected:
437+
azure_iot_start(&azure_iot);
436438
break;
437439
default:
438440
break;

0 commit comments

Comments
 (0)