[wifi] Add optional multi_ap mode to select strongest AP by RSSI - #1581
Open
deltecent wants to merge 1 commit into
Open
[wifi] Add optional multi_ap mode to select strongest AP by RSSI#1581deltecent wants to merge 1 commit into
deltecent wants to merge 1 commit into
Conversation
ESP-IDF's default WIFI_FAST_SCAN associates to the first AP that answers for the configured SSID, ignoring signal strength. In a meshed/multi-AP SSID (extenders/repeaters, mixed 2.4/5 GHz) a stationary FujiNet can latch onto a weak/distant AP and stay there, causing flaky throughput and periodic disconnects even when a much stronger same-SSID AP is available. Add a [WiFi] multi_ap config option (default 0). When enabled, connect() and test_connect() set an all-channel, signal-sorted scan (WIFI_ALL_CHANNEL_SCAN + WIFI_CONNECT_AP_BY_SIGNAL) so the strongest same-SSID AP is chosen. Default preserves ESP-IDF's fast scan, so behavior is unchanged unless the option is turned on. An all-channel scan makes association somewhat slower, which is why it is opt-in; no minimum-RSSI threshold is set, so a lone weak AP remains usable. Also log bssid/channel/rssi on WIFI_EVENT_STA_CONNECTED so the selected AP is visible in the debug output regardless of scan mode. Config plumbing: wifi_info.multi_ap, get/store_wifi_multi_ap(), parse+save in the existing [WiFi] section. Fixes FujiNetWIFI#1575 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GXyRJPxQQxGYBUHJRJG6JY
deltecent
force-pushed
the
wifi-strongest-ap
branch
from
August 28, 2026 11:31
547d3b6 to
4fb9dfb
Compare
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
Fixes #1575.
ESP-IDF's default
WIFI_FAST_SCANassociates to the first AP that answers for the configured SSID, ignoring signal strength. In a meshed / multi-AP SSID (extenders/repeaters, mixed 2.4/5 GHz), a stationary FujiNet can latch onto a weak/distant AP and stay there — flaky throughput and periodic disconnects even when a much stronger same-SSID AP is available.Approach: opt-in via config, fast scan stays the default
This adds a
multi_apoption to the existing[WiFi]section offnconfig.ini(default0). Behavior is unchanged unless it's turned on.When enabled,
WiFiManager::connect()andtest_connect()set an all-channel, signal-sorted scan beforeesp_wifi_set_config:so the strongest same-SSID AP is chosen at connect time. No minimum-RSSI threshold is set, so a lone weak AP stays usable.
It also logs
bssid/channel/rssionWIFI_EVENT_STA_CONNECTED(unconditional — useful in both scan modes) so the selected AP is visible in the debug output.Why opt-in
WIFI_ALL_CHANNEL_SCANscans every channel before associating, so connection setup is somewhat slower than fast scan. Rather than change the default connect path for everyone, this leaves fast scan as the default and lets users in meshed/multi-AP environments opt in.Changes
lib/hardware/fnWiFi.cpp— gate the all-channel/signal-sorted scan onConfig.get_wifi_multi_ap()inconnect()andtest_connect(); log AP bssid/channel/rssi on connect. (ESP-only; the PC build usesfnDummyWiFi.)lib/config/fnConfig.h,fnc_wifi.cpp,fnc_save.cpp—wifi_info.multi_apfield,get/store_wifi_multi_ap(), and parse/save in the existing[WiFi]section.Testing
fnc_wifi/fnc_saveexercised by the build).🤖 Generated with Claude Code
https://claude.ai/code/session_01GXyRJPxQQxGYBUHJRJG6JY