Optimize WiFi connection time by using WIFI_FAST_SCAN #25
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
Optimizes WiFi connection startup time in wifiManager.cpp by switching from full channel scan to fast scan mode.
Before: WiFi connected at ~6279ms
After: WiFi connected at ~3897ms
Improvement: ~2000ms faster
Changes
File: wifiManager.cpp
1. Switch to
WIFI_FAST_SCANmode// Changed from WIFI_ALL_CHANNEL_SCAN to WIFI_FAST_SCAN _wifi_cfg.sta.scan_method = WIFI_FAST_SCAN;Why
WIFI_FAST_SCANis faster:WIFI_ALL_CHANNEL_SCANWIFI_FAST_SCANTrade-off: May not connect to the strongest AP if multiple APs share the same SSID. This is acceptable for typical single-AP home/lab environments where this eye tracker operates.
2.Check whether WIFI is open before closing
First connection - WiFi hasn't started yet. Check whether WIFI is open before closing
3. Reduce connection timeout
Changed
portMAX_DELAYtopdMS_TO_TICKS(8000)for hardcoded credentials connection. This doesn't affect successful connection time but prevents indefinite blocking on failures.Testing