esp32 哪个函数返回wifi连接失败原因
-
- Posts: 28
- Joined: Mon Nov 21, 2022 8:42 am
esp32 哪个函数返回wifi连接失败原因
esp32 哪个函数返回wifi连接失败原因,我尝试过特意输错密码,打印esp_wifi_connect的返回值,但是返回的是0,意思就是连接成功的,有没有相关例子,是不是我哪里写错了。
Re: esp32 哪个函数返回wifi连接失败原因
https://docs.espressif.com/projects/esp ... sp32-wi-fi
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) {
wifi_event_sta_disconnected_t *sta_disconnect_evt = (wifi_event_sta_disconnected_t*)event_data;
ESP_LOGI(TAG, "wifi disconnect reason:%d", sta_disconnect_evt->reason);
esp_wifi_connect();
xEventGroupClearBits(s_wifi_event_group, CONNECTED_BIT);
}
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) {
wifi_event_sta_disconnected_t *sta_disconnect_evt = (wifi_event_sta_disconnected_t*)event_data;
ESP_LOGI(TAG, "wifi disconnect reason:%d", sta_disconnect_evt->reason);
esp_wifi_connect();
xEventGroupClearBits(s_wifi_event_group, CONNECTED_BIT);
}
-
- Posts: 28
- Joined: Mon Nov 21, 2022 8:42 am
Re: esp32 哪个函数返回wifi连接失败原因
这部分程序在哪里调用比较好??BMNLiLi wrote: ↑Fri Sep 15, 2023 8:53 amhttps://docs.espressif.com/projects/esp ... sp32-wi-fi
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) {
wifi_event_sta_disconnected_t *sta_disconnect_evt = (wifi_event_sta_disconnected_t*)event_data;
ESP_LOGI(TAG, "wifi disconnect reason:%d", sta_disconnect_evt->reason);
esp_wifi_connect();
xEventGroupClearBits(s_wifi_event_group, CONNECTED_BIT);
}
Re: esp32 哪个函数返回wifi连接失败原因
这段函数就是可以在wifi的句柄里面去用kalok_2022 wrote: ↑Mon Sep 18, 2023 6:00 am这部分程序在哪里调用比较好??BMNLiLi wrote: ↑Fri Sep 15, 2023 8:53 amhttps://docs.espressif.com/projects/esp ... sp32-wi-fi
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) {
wifi_event_sta_disconnected_t *sta_disconnect_evt = (wifi_event_sta_disconnected_t*)event_data;
ESP_LOGI(TAG, "wifi disconnect reason:%d", sta_disconnect_evt->reason);
esp_wifi_connect();
xEventGroupClearBits(s_wifi_event_group, CONNECTED_BIT);
}
Who is online
Users browsing this forum: weddawd and 26 guests