From cd971319cbc19b7a7c54b46c9e7d7d38e5b6d01f Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Wed, 2 Oct 2024 15:26:32 +0300 Subject: [PATCH] Fix WPS example config initialization (#10399) * fix(wps): fixes wps struct initialization C99 complaint * fix(wps): adds memset to 0 --------- Co-authored-by: Rodrigo Garcia --- libraries/WiFi/examples/WPS/WPS.ino | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libraries/WiFi/examples/WPS/WPS.ino b/libraries/WiFi/examples/WPS/WPS.ino index 1a6cc6114..fc353dcbf 100644 --- a/libraries/WiFi/examples/WPS/WPS.ino +++ b/libraries/WiFi/examples/WPS/WPS.ino @@ -25,7 +25,15 @@ 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; + 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"); + 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));