From 815e4ec64d14c8757b55211efc15212c6cca65bb Mon Sep 17 00:00:00 2001 From: Ewerton Scaboro da Silva Date: Wed, 31 May 2023 09:53:14 -0700 Subject: [PATCH 1/3] Fix leaks on wifi reconnection, update docs --- examples/Azure_IoT_Adu_ESP32/Azure_IoT_Adu_ESP32.ino | 2 ++ examples/Azure_IoT_Adu_ESP32/readme.md | 3 ++- examples/Azure_IoT_Central_ESP32/Azure_IoT_Central_ESP32.ino | 2 ++ examples/Azure_IoT_Central_ESP32/readme.md | 3 +++ .../Azure_IoT_Central_ESP32_AzureIoTKit.ino | 4 +++- examples/Azure_IoT_Central_ESP32_AzureIoTKit/readme.md | 3 +++ examples/Azure_IoT_Hub_ESP32/Azure_IoT_Hub_ESP32.ino | 2 ++ examples/Azure_IoT_Hub_ESP32/readme.md | 3 ++- examples/Azure_IoT_Hub_ESP8266/Azure_IoT_Hub_ESP8266.ino | 2 ++ examples/Azure_IoT_Hub_ESP8266/readme.md | 2 +- 10 files changed, 22 insertions(+), 4 deletions(-) diff --git a/examples/Azure_IoT_Adu_ESP32/Azure_IoT_Adu_ESP32.ino b/examples/Azure_IoT_Adu_ESP32/Azure_IoT_Adu_ESP32.ino index ca25ac06..a435fac4 100644 --- a/examples/Azure_IoT_Adu_ESP32/Azure_IoT_Adu_ESP32.ino +++ b/examples/Azure_IoT_Adu_ESP32/Azure_IoT_Adu_ESP32.ino @@ -219,6 +219,8 @@ static void connect_to_wifi() Logger.Info("Connecting to WIFI SSID " + String(ssid)); WiFi.mode(WIFI_STA); + WiFi.disconnect(); + delay(100); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { diff --git a/examples/Azure_IoT_Adu_ESP32/readme.md b/examples/Azure_IoT_Adu_ESP32/readme.md index 8521bfc0..238dc712 100644 --- a/examples/Azure_IoT_Adu_ESP32/readme.md +++ b/examples/Azure_IoT_Adu_ESP32/readme.md @@ -46,7 +46,7 @@ This is a "to-the-point" guide outlining how to run an Azure SDK for Embedded C - Setting up and configuring the necessary services for the scenario. - Configuration, build, and run instructions for the IoT ADU sample. -_The following was run on Windows 11 and Ubuntu Desktop 20.04 environments, with Arduino IDE 1.8.19 and ESP32 board library version 2.0.4._ +_The following was run on Windows 11, with Arduino IDE 2.1.0 and ESP32 board library version 2.0.9._ ## Prerequisites @@ -63,6 +63,7 @@ _The following was run on Windows 11 and Ubuntu Desktop 20.04 environments, with - ESP32 boards are not natively supported by Arduino IDE, so you need to add them manually. - Follow the [instructions](https://github.com/espressif/arduino-esp32) in the official ESP32 repository. + - If your ESP32 board is not recognized and a COM port is not mapped by your computer, try installing the [serial port drivers](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/establish-serial-connection.html#connect-esp32-to-pc) recommended by ESPRESSIF. - Install Azure CLI and Azure IoT Module See steps to install both [here](https://learn.microsoft.com/azure/iot-hub-device-update/create-update?source=recommendations#prerequisites). 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 23254057..a250d057 100644 --- a/examples/Azure_IoT_Central_ESP32/Azure_IoT_Central_ESP32.ino +++ b/examples/Azure_IoT_Central_ESP32/Azure_IoT_Central_ESP32.ino @@ -470,6 +470,8 @@ static void connect_to_wifi() LogInfo("Connecting to WIFI wifi_ssid %s", wifi_ssid); WiFi.mode(WIFI_STA); + WiFi.disconnect(); + delay(100); WiFi.begin(wifi_ssid, wifi_password); while (WiFi.status() != WL_CONNECTED) { diff --git a/examples/Azure_IoT_Central_ESP32/readme.md b/examples/Azure_IoT_Central_ESP32/readme.md index d2ed9bfc..ecc8a842 100644 --- a/examples/Azure_IoT_Central_ESP32/readme.md +++ b/examples/Azure_IoT_Central_ESP32/readme.md @@ -21,6 +21,8 @@ You will complete the following tasks: * Build the image and flash it onto the ESP32 * Use Azure IoT Central to create cloud components, view properties, view device telemetry, and call direct commands +_The following was run on Windows 11, with Arduino IDE 2.1.0 and ESP32 board library version 2.0.9._ + ## Prerequisites * Have the latest [Arduino IDE](https://www.arduino.cc/en/Main/Software) installed. @@ -29,6 +31,7 @@ You will complete the following tasks: - ESP32 boards are not natively supported by Arduino IDE, so you need to add them manually. - Follow the [instructions](https://github.com/espressif/arduino-esp32) in the official ESP32 repository. + - If your ESP32 board is not recognized and a COM port is not mapped by your computer, try installing the [serial port drivers](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/establish-serial-connection.html#connect-esp32-to-pc) recommended by ESPRESSIF. * Hardware 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 0105f013..38db4038 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 @@ -473,7 +473,9 @@ static void connect_to_wifi() { LogInfo("Connecting to WIFI wifi_ssid %s", wifi_ssid); - WiFi.mode(WIFI_STA); + WiFi.mode(WIFI_STA);` + WiFi.disconnect(); + delay(100); WiFi.begin(wifi_ssid, wifi_password); while (WiFi.status() != WL_CONNECTED) { diff --git a/examples/Azure_IoT_Central_ESP32_AzureIoTKit/readme.md b/examples/Azure_IoT_Central_ESP32_AzureIoTKit/readme.md index 84c14a29..fb6683bc 100644 --- a/examples/Azure_IoT_Central_ESP32_AzureIoTKit/readme.md +++ b/examples/Azure_IoT_Central_ESP32_AzureIoTKit/readme.md @@ -21,6 +21,8 @@ You will complete the following tasks: * Build the image and flash it onto the ESP32 DevKit * Use Azure IoT Central to create cloud components, view properties, view device telemetry, and call direct commands +_The following was run on Windows 11, with Arduino IDE 2.1.0 and ESP32 board library version 2.0.9._ + ## Prerequisites * Have the latest [Arduino IDE](https://www.arduino.cc/en/Main/Software) installed. @@ -29,6 +31,7 @@ You will complete the following tasks: - ESP32 boards are not natively supported by Arduino IDE, so you need to add them manually. - Follow the [instructions](https://github.com/espressif/arduino-esp32) in the official ESP32 repository. + - If your ESP32 board is not recognized and a COM port is not mapped by your computer, try installing the [serial port drivers](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/establish-serial-connection.html#connect-esp32-to-pc) recommended by ESPRESSIF. * Hardware diff --git a/examples/Azure_IoT_Hub_ESP32/Azure_IoT_Hub_ESP32.ino b/examples/Azure_IoT_Hub_ESP32/Azure_IoT_Hub_ESP32.ino index 7eccad56..c2ad6c60 100644 --- a/examples/Azure_IoT_Hub_ESP32/Azure_IoT_Hub_ESP32.ino +++ b/examples/Azure_IoT_Hub_ESP32/Azure_IoT_Hub_ESP32.ino @@ -99,6 +99,8 @@ static void connectToWiFi() Logger.Info("Connecting to WIFI SSID " + String(ssid)); WiFi.mode(WIFI_STA); + WiFi.disconnect(); + delay(100); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { diff --git a/examples/Azure_IoT_Hub_ESP32/readme.md b/examples/Azure_IoT_Hub_ESP32/readme.md index c65ca647..5be13f4c 100644 --- a/examples/Azure_IoT_Hub_ESP32/readme.md +++ b/examples/Azure_IoT_Hub_ESP32/readme.md @@ -38,7 +38,7 @@ This is a "to-the-point" guide outlining how to run an Azure SDK for Embedded C - Configuration instructions for the Arduino IDE to compile a sample using the [Azure SDK for Embedded C](https://github.com/Azure/azure-sdk-for-c). - Configuration, build, and run instructions for the IoT Hub telemetry sample. -_The following was run on Windows 10 and Ubuntu Desktop 20.04 environments, with Arduino IDE 1.8.15 and ESP32 board library version 1.0.6._ +_The following was run on Windows 11, with Arduino IDE 2.1.0 and ESP32 board library version 2.0.9._ ## Prerequisites @@ -53,6 +53,7 @@ _The following was run on Windows 10 and Ubuntu Desktop 20.04 environments, with - ESP32 boards are not natively supported by Arduino IDE, so you need to add them manually. - Follow the [instructions](https://github.com/espressif/arduino-esp32) in the official ESP32 repository. + - If your ESP32 board is not recognized and a COM port is not mapped by your computer, try installing the [serial port drivers](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/establish-serial-connection.html#connect-esp32-to-pc) recommended by ESPRESSIF. - Have one of the following interfaces to your Azure IoT Hub set up: - [Azure Command Line Interface](https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest) (Azure CLI) utility installed, along with the [Azure IoT CLI extension](https://github.com/Azure/azure-iot-cli-extension). diff --git a/examples/Azure_IoT_Hub_ESP8266/Azure_IoT_Hub_ESP8266.ino b/examples/Azure_IoT_Hub_ESP8266/Azure_IoT_Hub_ESP8266.ino index c499b206..f45f743f 100644 --- a/examples/Azure_IoT_Hub_ESP8266/Azure_IoT_Hub_ESP8266.ino +++ b/examples/Azure_IoT_Hub_ESP8266/Azure_IoT_Hub_ESP8266.ino @@ -90,6 +90,8 @@ static void connectToWiFi() Serial.println(ssid); WiFi.mode(WIFI_STA); + WiFi.disconnect(); + delay(100); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { diff --git a/examples/Azure_IoT_Hub_ESP8266/readme.md b/examples/Azure_IoT_Hub_ESP8266/readme.md index 95fa475f..6fc0a6ba 100644 --- a/examples/Azure_IoT_Hub_ESP8266/readme.md +++ b/examples/Azure_IoT_Hub_ESP8266/readme.md @@ -32,7 +32,7 @@ This is a "to-the-point" guide outlining how to run an Azure SDK for Embedded C - Configuration instructions for the Arduino IDE to compile a sample using the Azure SDK for Embedded C. - Configuration, build, and run instructions for the IoT Hub telemetry sample. -_The following was run on Windows 10 and Ubuntu Desktop 20.04 environments, with Arduino IDE 1.8.15 and Esp8266 module 3.0.1._ +_The following was run on Windows 11, with Arduino IDE 2.1.0 and Esp8266 module 3.1.2._ ## Prerequisites From 6b176b1a4eddc3da7fd8e175c7be2c0474aa25c4 Mon Sep 17 00:00:00 2001 From: Ewerton Scaboro da Silva Date: Wed, 31 May 2023 09:54:25 -0700 Subject: [PATCH 2/3] Bump minor version in library.properties --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index fa522e21..bc4c9be8 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Azure SDK for C -version=1.1.3 +version=1.1.4 author=Microsoft Corporation maintainer=Microsoft Corporation sentence=Azure SDK for C library for Arduino. From 854b9d700fbe4921dfae8ca92909dc72fe71f47b Mon Sep 17 00:00:00 2001 From: Ewerton Scaboro da Silva Date: Wed, 31 May 2023 10:01:32 -0700 Subject: [PATCH 3/3] Fix stray char --- .../Azure_IoT_Central_ESP32_AzureIoTKit.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 38db4038..405d41de 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 @@ -473,7 +473,7 @@ static void connect_to_wifi() { LogInfo("Connecting to WIFI wifi_ssid %s", wifi_ssid); - WiFi.mode(WIFI_STA);` + WiFi.mode(WIFI_STA); WiFi.disconnect(); delay(100); WiFi.begin(wifi_ssid, wifi_password);