WiFi: select strongest signal when multiple APs with same SSID exist#31
Open
JinruiWang wants to merge 2 commits into78:mainfrom
Open
WiFi: select strongest signal when multiple APs with same SSID exist#31JinruiWang wants to merge 2 commits into78:mainfrom
JinruiWang wants to merge 2 commits into78:mainfrom
Conversation
added 2 commits
March 24, 2026 20:19
When multiple APs share the same SSID name, only select the one with the strongest signal (RSSI) to connect, instead of relying on the WiFi driver's BSSID selection which may choose a weaker signal or a previously remembered BSSID.
When remember_bssid_ is enabled and there are multiple APs with the same SSID (e.g., mesh network or dual-band router), connect to the one with the strongest signal instead of using the remembered BSSID which may have weaker signal.
Owner
|
对于当前的方案,如果 remember_bssid_ 是 false,esp-idf会动态管理当前连接的AP,并在掉线后自动切换到相同SSID的信号强的AP。当 remember_bssid_ 是 true时,会记住当前连接的AP,并在下次仍然连接该AP。 需要考虑一个问题,esp-idf第一轮拿到的AP列表,信号强度不一定准确,AP列表也不一定完整,有可能信号最强的那个AP并没有出现在第一次扫描的结果中。 |
Author
可能我理解的不够深刻。这是我这几天调试固件时碰到的问题,它总是在启动时连接到离我工位远的一个同名 ap 上,导致无法正常连接到我电脑上运行的 server,所以才有了这个 PR。 |
Owner
|
你需要的应该是:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
remember_bssid_is enabled and there are multiple APs with the same SSID (e.g., mesh network or dual-band router), connect to the one with the strongest signal instead of using the remembered BSSID which may have weaker signal.Changes
include/wifi_station.hAdded
has_multiple_same_ssidfield toWifiApRecordstruct to track if multiple APs with the same SSID were found during scan.wifi_station.ccHandleScanResult():has_multiple_same_ssidflagStartConnect():remember_bssid_is enabled AND only one AP with this SSID exists → use remembered BSSID (original behavior)remember_bssid_is enabled AND multiple APs with same SSID exist → connect to strongest signal (new behavior)remember_bssid_is disabled → connect to strongest signal (unchanged)Use Case
Useful for mesh networks or dual-band routers where you want to remember the WiFi credentials but always connect to the strongest available AP with that SSID.