fix(esp_wifi): Add some bugfixes and cleanup in softAP

1. Fix wrong reason code in 'WIFI_EVENT_AP_STADISCONNECTED' event
2. cleanup in softAP for disconnecting connected station
3. Update examples to display reason while processing WIFI_EVENT_AP_STADISCONNECTED event
This commit is contained in:
Sarvesh Bodakhe
2024-05-18 18:34:51 +05:30
committed by wangtao@espressif.com
parent 411385cf8c
commit c3d4270d79
7 changed files with 13 additions and 13 deletions

View File

@@ -93,8 +93,8 @@ static void wifi_event_handler(void *arg, esp_event_base_t event_base,
MAC2STR(event->mac), event->aid);
} else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_AP_STADISCONNECTED) {
wifi_event_ap_stadisconnected_t *event = (wifi_event_ap_stadisconnected_t *) event_data;
ESP_LOGI(TAG_AP, "Station "MACSTR" left, AID=%d",
MAC2STR(event->mac), event->aid);
ESP_LOGI(TAG_AP, "Station "MACSTR" left, AID=%d, reason:%d",
MAC2STR(event->mac), event->aid, event->reason);
} else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) {
esp_wifi_connect();
ESP_LOGI(TAG_STA, "Station started");
@@ -148,7 +148,7 @@ esp_netif_t *wifi_init_sta(void)
.password = EXAMPLE_ESP_WIFI_STA_PASSWD,
.scan_method = WIFI_ALL_CHANNEL_SCAN,
.failure_retry_cnt = EXAMPLE_ESP_MAXIMUM_RETRY,
/* Authmode threshold resets to WPA2 as default if password matches WPA2 standards (pasword len => 8).
/* Authmode threshold resets to WPA2 as default if password matches WPA2 standards (password len => 8).
* If you want to connect the device to deprecated WEP/WPA networks, Please set the threshold value
* to WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK and set the password with length and format matching to
* WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK standards.