Wi-Fi auto join on boot
Posted: Wed Jun 09, 2021 2:58 pm
Hello,
I'm trying to find a way to automatically join a previously joined Wi-Fi access point after a reboot.
As far as I know this feature should do the trick: https://docs.espressif.com/projects/esp ... -nvs-flash
I used the ESP IDF station example to join first my access point: https://github.com/espressif/esp-idf/bl ... ple_main.c
Then I removed entirely the Wi-Fi configuration with my access point (i.e. I no longer try to explicitly join it) by commenting the following lines:
But the connected event is never received from the driver. I assumed that, given what the documentation states, my access point would be automatically joined but it is not the case.
Am I missing something? The NVS flash is correctly enabled in my menuconfig.
Thanks,
Benjamin
I'm trying to find a way to automatically join a previously joined Wi-Fi access point after a reboot.
As far as I know this feature should do the trick: https://docs.espressif.com/projects/esp ... -nvs-flash
I used the ESP IDF station example to join first my access point: https://github.com/espressif/esp-idf/bl ... ple_main.c
Then I removed entirely the Wi-Fi configuration with my access point (i.e. I no longer try to explicitly join it) by commenting the following lines:
Code: Select all
wifi_config_t wifi_config = {
.sta = {
.ssid = EXAMPLE_ESP_WIFI_SSID,
.password = EXAMPLE_ESP_WIFI_PASS,
/* Setting a password implies station will connect to all security modes including WEP/WPA.
* However these modes are deprecated and not advisable to be used. Incase your Access point
* doesn't support WPA2, these mode can be enabled by commenting below line */
.threshold.authmode = WIFI_AUTH_WPA2_PSK,
.pmf_cfg = {
.capable = true,
.required = false
},
},
};
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
Am I missing something? The NVS flash is correctly enabled in my menuconfig.
Thanks,
Benjamin