Significant WiFi scan slowdowns
Closed this issue · 3 comments
Profiling of the scan loop shows that multiple seconds are wasted for each scan. The initial theory was that the SD card could be introducing slowdowns, but it seems the SD card slowdown is limited to around 40ms; a separate issue exists for this at #92.
This slowdown has been reproduced even without writing any data to the SD card.
It seems like multiple calls to the WiFi.xxxxx(i)
functions will cause a major slowdown but the exact cause and method to reproduce is still unknown. This appears to be a bug, likely in the ESP32 core.
Currently it appears all releases have approx 2s of wasted time per scan. Fixing this bug can allow the wardriver to perform ~40 scans per minute. Right now it is likely around ~17.
This likely also affects side B.
I'm able to reliably reproduce this. By calling WiFi.BSSIDstr(i)
more than once, this slowdown occurs. Calling it exactly once is okay.
The problem also occurs when using WiFi.BSSID(i)
+ WiFi.BSSIDstr(i)
. The problem seems limited to only the BSSID calls, but this means calling both the str
version and regular BSSID function will trigger the issue. The fix/workaround would be to simply call the standard WiFi.BSSID
, store it, and convert it ourselves.
All recent versions of the wardriver do call this more than once, causing the slowdown. A quick look through the ESP32 core code doesn't give me any clues to where the issue is actually happening.
No changes have been made to side B. I still need to test if the issue exists there and fix it if so.
Addressed on side B with #137
Todo: Change the printf statements within primary_scan_loop
on A to use the this_bssid_raw
, this_bssid
values instead of making calls to WiFi.BSSID...