mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 13:52:15 +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
|
|
@ -257,6 +257,21 @@ static void test_worthRoaming_any_ap_while_disconnected() {
|
|||
TEST_ASSERT_TRUE(worthRoaming(false, 0, -90, 6));
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* wifiAuthModeName
|
||||
********************************************************************/
|
||||
static void test_wifiAuthModeName_matches_the_idf_enum() {
|
||||
TEST_ASSERT_EQUAL_STRING("OPEN", wifiAuthModeName(0));
|
||||
TEST_ASSERT_EQUAL_STRING("WPA2", wifiAuthModeName(3));
|
||||
TEST_ASSERT_EQUAL_STRING("WPA3", wifiAuthModeName(6));
|
||||
TEST_ASSERT_EQUAL_STRING("WPA2/WPA3", wifiAuthModeName(7));
|
||||
TEST_ASSERT_EQUAL_STRING("WAPI", wifiAuthModeName(8));
|
||||
}
|
||||
static void test_wifiAuthModeName_unknown_past_the_shared_values() {
|
||||
TEST_ASSERT_EQUAL_STRING("UNKNOWN", wifiAuthModeName(9));
|
||||
TEST_ASSERT_EQUAL_STRING("UNKNOWN", wifiAuthModeName(255));
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* heapEmitTarget
|
||||
********************************************************************/
|
||||
|
|
@ -369,6 +384,8 @@ int main(int argc, char **argv) {
|
|||
RUN_TEST(test_worthRoaming_needs_the_full_gain);
|
||||
RUN_TEST(test_worthRoaming_never_to_a_weaker_ap);
|
||||
RUN_TEST(test_worthRoaming_any_ap_while_disconnected);
|
||||
RUN_TEST(test_wifiAuthModeName_matches_the_idf_enum);
|
||||
RUN_TEST(test_wifiAuthModeName_unknown_past_the_shared_values);
|
||||
RUN_TEST(test_heapEmitTarget_one_client_always_gets_it);
|
||||
RUN_TEST(test_heapEmitTarget_broadcasts_once_per_interval);
|
||||
RUN_TEST(test_heapEmitTarget_room_in_between);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue