Skip to content

More Wi-Fi improvements#440

Merged
stintel merged 4 commits intomainfrom
feature/wifi_scan
May 29, 2025
Merged

More Wi-Fi improvements#440
stintel merged 4 commits intomainfrom
feature/wifi_scan

Conversation

@stintel
Copy link
Collaborator

@stintel stintel commented May 29, 2025

No description provided.

stintel added 4 commits May 29, 2025 08:57
According the comment for wifi_auth_mode_t in wifi_scan_threshold_t, if
this is unset, and password len >=8, the authmode threshold will
default to WIFI_AUTH_WPA2_PSK. As we enforce a minimum of 8 characters
in Willow Web Flasher and Willow Application Server, the esp_wifi driver
should implicitly already set the authmode threshold to
WIFI_AUTH_WPA2_PSK. Let's do this explicitly, so it is clear from
looking at the Willow network code, and it will not change if Espressif
decides to change the default.
The esp_wifi driver uses WIFI_FAST_SCAN by default, which means it will
stop scanning after it finds a matching AP. This is the main reason
Willow sometimes connect to an AP with a terrible signal strength.

Change the scan method to WIFI_ALL_CHANNEL_SCAN so that all channels
will be scanned. This seems to increase the connect time with 2 seconds,
but this is an acceptable trade-off to provide a better user experience.
Willow becomes unusable if the signal strength is too low.

Reported-by: Ciaran Jessup <ciaranj@gmail.com>
A comment in the esp_wifi driver code suggests that using this
sort_method could result in connecting to an AP without encryption, if
its signal strength is higher, but now that we set the authmode
threshold to WIFI_AUTH_WPA2_PSK explicitly, we don't need to worry about
that.

Let's use WIFI_CONNECT_AP_BY_SIGNAL so that hopefully Willow always ends
up on the AP with the best signal strength.

802.11v is still useful, as e.g. when upgrading APs, depending on the
order, Willow might roam to an AP with bad signal strength, and when the
better AP comes back online, it might not roam back. 802.11v allows the
AP or controller to tell Willow to transition to the better AP.
Even after changing scan_method and sort_order, a user reported Willow
would still not connect to the AP with the best signal strength. This
turns out to be due to failure on the initial connection attempt(s).

Let's set the failure_retry_cnt to 3, which for the user resulted in
Willow always ending up on the AP with the best signal strength. The
retries are sub-ms, so this shouldn't noticably increase the connect
time.

Reported-by: Ciaran Jessup <ciaranj@gmail.com>
@stintel stintel merged commit 92b89e0 into main May 29, 2025
9 checks passed
@stintel stintel deleted the feature/wifi_scan branch May 29, 2025 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant