I'd like for my ESP32-S3 to connect to any WiFi station, irrespective of its security setting. After initiating esp_wifi_start() and providing the WiFi credentials during the wifi provisioning process, I currently have to disconnect the wifi connection, scan and retrieve security setting of the WiFi station I'm using, adjust threshold.authmode setting in the wifi config object, then call esp_wifi_connect() again. But I also understand that esp_wifi_connect() itself calls esp_wifi_scan_start() at some point. Is there a way for threshold.authmode to be adjusted during this esp_wifi_connect() process so the app can avoid some unnecessary, potentially redundant steps? Here are my current steps (other application logic not included below):
Complete WiFi provisioning
ESP_ERROR_CHECK(esp_wifi_stop());
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
ESP_ERROR_CHECK(esp_wifi_start());
When event WIFI_EVENT_STA_START is triggered, it calls:
ESP_ERROR_CHECK(esp_wifi_get_config(WIFI_IF_STA, &wifi_sta_config));
ESP_ERROR_CHECK(esp_wifi_scan_start(&scan_config, true));
ESP_ERROR_CHECK((esp_wifi_scan_get_ap_records(&number, &ap_record));
wifi_sta_config->sta.threshold.authmode = ap_record.authmode;
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_sta_config));
esp_wifi_connect();
The code compiles, but it would be nice if esp_wifi_connect() would, by default, adjust the threshold.authmode of the WiFi station ESP32-S3 is trying to connect to. Or if that's taken care of during the provisioning process, that would be fine too. Any other options?
Does esp_wifi_connect() adjust threshold.authmode during scanning process?
-
MicroController
- Posts: 2661
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Does esp_wifi_connect() adjust threshold.authmode during scanning process?
Why do you want to re-adjust the auth threshold if you're ok with any level anyway?
Re: Does esp_wifi_connect() adjust threshold.authmode during scanning process?
So you're saying that so long as I keep the default threshold.authmode at CONFIG_ESP_WIFI_AUTH_OPEN, pmf_cfg.capable at 1 and pmf_cfg.required at 0, the esp_wifi_connect() api will find all APs and apply the correct security level to the AP that matches the SSID provided? If that's the case, then that's great - it should address my issue. Appreciate the confirmation. Thanks.
-
MicroController
- Posts: 2661
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Does esp_wifi_connect() adjust threshold.authmode during scanning process?
Yes, the threshold is the lowest security threshold you're willing to accept. Better security WiFis will also work, but not lower ones.
Who is online
Users browsing this forum: Google [Bot], Qwantbot and 7 guests