feat(example): set authmode threshold to WPA2 when password set

This commit is contained in:
Zhang Jun Hao
2020-07-08 11:19:21 +08:00
parent d1a8992fdb
commit fbfb4df9c8

View File

@@ -122,6 +122,14 @@ void wifi_init_sta()
},
};
/* 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 */
if (strlen(EXAMPLE_ESP_WIFI_PASS)) {
wifi_config.sta.threshold.authmode = WIFI_AUTH_WPA2_PSK;
}
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
ESP_ERROR_CHECK(esp_wifi_start() );