From de11207e99f30f3f595eb873d4a9e2323140ca1c Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Thu, 26 Sep 2024 09:30:26 -0300 Subject: [PATCH 1/2] fix(wps): fixes wps struct initialization C99 complaint --- libraries/WiFi/examples/WPS/WPS.ino | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/WiFi/examples/WPS/WPS.ino b/libraries/WiFi/examples/WPS/WPS.ino index 1a6cc6114ee..4eeafef8159 100644 --- a/libraries/WiFi/examples/WPS/WPS.ino +++ b/libraries/WiFi/examples/WPS/WPS.ino @@ -25,7 +25,14 @@ WPS (pin is 00000000) #define ESP_WPS_MODE WPS_TYPE_PBC void wpsStart() { - esp_wps_config_t config = WPS_CONFIG_INIT_DEFAULT(ESP_WPS_MODE); + esp_wps_config_t config; + //Same as config = WPS_CONFIG_INIT_DEFAULT(ESP_WPS_MODE); + config.wps_type = ESP_WPS_MODE; + strcpy(config.factory_info.manufacturer, "ESPRESSIF"); + strcpy(config.factory_info.model_number, CONFIG_IDF_TARGET); + strcpy(config.factory_info.model_name, "ESPRESSIF IOT"); + strcpy(config.factory_info.device_name, "ESP DEVICE"); + strcpy(config.pin, "00000000"); esp_err_t err = esp_wifi_wps_enable(&config); if (err != ESP_OK) { Serial.printf("WPS Enable Failed: 0x%x: %s\n", err, esp_err_to_name(err)); From 585022e93f5c3c84bd0ce4f1eedc1076ce206e4b Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Thu, 26 Sep 2024 09:42:04 -0300 Subject: [PATCH 2/2] fix(wps): adds memset to 0 --- libraries/WiFi/examples/WPS/WPS.ino | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/WiFi/examples/WPS/WPS.ino b/libraries/WiFi/examples/WPS/WPS.ino index 4eeafef8159..fc353dcbfb8 100644 --- a/libraries/WiFi/examples/WPS/WPS.ino +++ b/libraries/WiFi/examples/WPS/WPS.ino @@ -26,6 +26,7 @@ WPS (pin is 00000000) void wpsStart() { esp_wps_config_t config; + memset(&config, 0, sizeof(esp_wps_config_t)); //Same as config = WPS_CONFIG_INIT_DEFAULT(ESP_WPS_MODE); config.wps_type = ESP_WPS_MODE; strcpy(config.factory_info.manufacturer, "ESPRESSIF");