mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
fix: join the AP our scan picked without rescanning every channel
Every WiFi connect took about 17.6 s. Our scan already picks the AP and passes its BSSID and channel to WiFi.begin(), but the connect still ran with WIFI_ALL_CHANNEL_SCAN. So the driver swept every channel again before it sent the first auth frame. A capture of the join showed the AP silent for 17.6 s, the radio on ch7 while the AP is on ch6, and then auth, association and the handshake all done in 80 ms. When the BSSID is known (the normal connect, the strongest-AP path and roaming), use WIFI_FAST_SCAN: the driver starts on that channel and joins the first match, and with bssid_set only that AP matches. The hidden-SSID path still uses the all-channel scan, since there it is what finds the strongest AP (rstrouse/ESPSomfy-RTS#294). Soft reboots now connect in 0.3-1.5 s. Also log how long each join took and the AP's security mode, on the connect line and on the roaming-scan lines, so a slow connect shows up. One boot in the old logs connected in 2.47 s, and nothing in its log explains it. After a power cut the first attempts can still fail on the AP side; a soft reboot sends a deauth first and doesn't have that problem. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e963a5adb3
commit
6d1e9064c2
4 changed files with 57 additions and 4 deletions
|
|
@ -74,6 +74,9 @@ struct RssiBroadcast {
|
|||
// connected it has to be at least minGain dBm stronger than the current AP so
|
||||
// a small swing doesn't make the device hop between APs.
|
||||
bool worthRoaming(bool connected, int currentRssi, int apRssi, int minGain);
|
||||
// A short name for a wifi_auth_mode_t value, for the logs. The values up to
|
||||
// WAPI are the same in ESP-IDF 4.4 and 5.x.
|
||||
const char *wifiAuthModeName(uint8_t authMode);
|
||||
// Who gets a memStatus event.
|
||||
enum class heap_emit_t : uint8_t { none, client, broadcast, room };
|
||||
// num is the socket client asked for, 255 for everyone. A broadcast goes out
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue