如何快速切换路由

kaisey
Posts: 81
Joined: Tue Mar 24, 2020 5:54 am

如何快速切换路由

Postby kaisey » Tue Apr 12, 2022 8:19 am

比如ESP32已经连接到了一个路由器,扫描到另外一个信号更强的路由器,如何快速切换到那个信号更强的路由器

kaisey
Posts: 81
Joined: Tue Mar 24, 2020 5:54 am

Re: 如何快速切换路由

Postby kaisey » Sun Apr 24, 2022 10:18 am

如果知道路由的信道,可以通过esp_err_t esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second);加快接入速度吗,需要在什么时候设置

ESP_LJY
Posts: 58
Joined: Mon Sep 27, 2021 3:06 am

Re: 如何快速切换路由

Postby ESP_LJY » Tue May 10, 2022 8:50 am

esp_wifi_set_channel 有使用限制,不能在扫描或者已连接AP时使用,且即使设置了连接时候对于从未连接过的 AP 扫描仍是从 信道 1开始。

可以通过设置 wifi_config.sta.channel 配置要连接的 AP 信道,连接扫描时从该信道开始扫描。
如果知道 AP 的 bssid, 还可以设置 wifi_config.sta.bssid,wifi_config.sta.bssid_set = 1.

另外如果想了解 漫游功能,可以参考示例 example/wifi/roaming ,支持 802.11 kv 的漫游协议。

kaisey
Posts: 81
Joined: Tue Mar 24, 2020 5:54 am

Re: 如何快速切换路由

Postby kaisey » Thu May 12, 2022 7:34 am

802.11 kv 需要路由器的支持吧,并且需要做复杂的配置,我想在普通路由器上实现尽量快的切换

按上面的设置测试后
我发现如果之前连接的A路由器,断开后在连接A路由器,非常的快, 如果断开后连接到B路由器还是慢,这是什么原因?

ESP_LJY
Posts: 58
Joined: Mon Sep 27, 2021 3:06 am

Re: 如何快速切换路由

Postby ESP_LJY » Thu May 12, 2022 8:01 am

是的,802.11kv 需要路由器支持。

第一次连接后保存了密钥信息,后面重连时候省略了计算时间,所以连接快。
连接新的 路由器,需要重新计算密钥,所以连接时间又变长了。

axellin
Posts: 200
Joined: Mon Sep 17, 2018 9:09 am

Re: 如何快速切换路由

Postby axellin » Thu May 12, 2022 8:09 am

On ESP device side, is there any API to check if the access point has 802.11kv support?

ESP_LJY
Posts: 58
Joined: Mon Sep 27, 2021 3:06 am

Re: 如何快速切换路由

Postby ESP_LJY » Thu May 12, 2022 11:09 am

axellin wrote:
Thu May 12, 2022 8:09 am
On ESP device side, is there any API to check if the access point has 802.11kv support?

I haven't found API to check 802.11kv currently. But you can add output log to check 802.11k and 802.11v after the [line][https://github.com/espressif/esp-idf/bl ... mon.c#L205]

Code: Select all

printf("802.11k rrm_used = %d, 802.11v BSSTrans %d\n\r", g_wpa_supp.rrm.rrm_used, g_wpa_supp.extend_caps[2]&BIT3);
.
The log will print after ESP station connected to an AP.
If the AP supported 802.111kv, the log is “802.11k rrm_used = 1, 802.11v BSSTrans 8”.

ESP_LJY
Posts: 58
Joined: Mon Sep 27, 2021 3:06 am

Re: 如何快速切换路由

Postby ESP_LJY » Fri May 13, 2022 2:10 am

axellin wrote:
Thu May 12, 2022 8:09 am
On ESP device side, is there any API to check if the access point has 802.11kv support?
Currently we don't have such API, do you want this during the scan or after connection?

axellin
Posts: 200
Joined: Mon Sep 17, 2018 9:09 am

Re: 如何快速切换路由

Postby axellin » Fri May 13, 2022 2:26 am

Hi LJY,
I want to know if the access point has 802.11kv support after the device joined an AP.
i.e. in case if access point does not support 802.11kv, I can know that and clarify the issue.
Otherwise, it's difficult to debug this issue when people reported issue like roaming does not happen.
(Some users are not technical people, they do not have access right to check the access point's settings).

ps. The printf does not help, my device has no console output in release build.
It would be helpful if there is a API to know if current connected access point have 802.11kv enabled or not.
(e.g. If esp_wifi_sta_get_ap_info() can get 802.11kv information in wifi_ap_record_t, it would be helpful).

ESP_LJY
Posts: 58
Joined: Mon Sep 27, 2021 3:06 am

Re: 如何快速切换路由

Postby ESP_LJY » Fri May 13, 2022 7:32 am

axellin wrote:
Fri May 13, 2022 2:26 am
Hi LJY,
I want to know if the access point has 802.11kv support after the device joined an AP.
i.e. in case if access point does not support 802.11kv, I can know that and clarify the issue.
Otherwise, it's difficult to debug this issue when people reported issue like roaming does not happen.
(Some users are not technical people, they do not have access right to check the access point's settings).

ps. The printf does not help, my device has no console output in release build.
It would be helpful if there is a API to know if current connected access point have 802.11kv enabled or not.
(e.g. If esp_wifi_sta_get_ap_info() can get 802.11kv information in wifi_ap_record_t, it would be helpful).
Our wifi team has been working on it and will apply the API soon.

Who is online

Users browsing this forum: No registered users and 53 guests