Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion firmware/examples/esp32-idf/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,22 @@ static void on_wifi_event(void *arg, esp_event_base_t base, int32_t id, void *da
esp_wifi_connect();
}
} else if (base == WIFI_EVENT && id == WIFI_EVENT_STA_DISCONNECTED) {
wifi_event_sta_disconnected_t *event = data;
if (event->reason == WIFI_REASON_IE_IN_4WAY_DIFFERS) {
/* Some boxes in WPA3 "compatibility mode" (WPA2 announced, WPA3 offered in a
* separate element) fail the handshake with WPA3: use WPA2 with that network. The
* driver saves it with the network. */
wifi_config_t cfg;
if (esp_wifi_get_config(WIFI_IF_STA, &cfg) == ESP_OK && !cfg.sta.disable_wpa3_compatible_mode) {
ESP_LOGW(TAG, "this network refuses WPA3 compatibility mode: using WPA2 with it");
cfg.sta.disable_wpa3_compatible_mode = 1;
esp_wifi_set_config(WIFI_IF_STA, &cfg);
}
}
xEventGroupClearBits(s_wifi_events, WIFI_CONNECTED);
xEventGroupSetBits(s_wifi_events, WIFI_DISCONNECTED);
if (!s_joining && wifi_configured()) {
ESP_LOGW(TAG, "Wi-Fi lost, reconnecting");
ESP_LOGW(TAG, "Wi-Fi lost (reason %d), reconnecting", event->reason);
esp_wifi_connect();
}
} else if (base == IP_EVENT && id == IP_EVENT_STA_GOT_IP) {
Expand Down
Loading