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 <rodrigo.garcia@espressif.com>
This commit is contained in:
Me No Dev 2024-10-02 15:26:32 +03:00 committed by GitHub
parent 84ddf0ad28
commit cd971319cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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));