Skip to content

Commit

Permalink
Wifi: allow longer scan time per channel to improve network detection
Browse files Browse the repository at this point in the history
Background: Android hotspots were only found on ~ every second scan.
The default active scan time seems to be limited to 200 ms per channel.
With max 500 ms per channel, a full scan may need up to 4 seconds, but
will find Android hotspots reliably.
  • Loading branch information
dexterbg committed Dec 5, 2020
1 parent 70fc51b commit 0a0c6ba
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vehicle/OVMS.V3/components/esp32wifi/src/esp32wifi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,8 @@ void esp32wifi::Scan(OvmsWriter* writer, bool json)
scanConf.channel = 0;
scanConf.show_hidden = true;
scanConf.scan_type = WIFI_SCAN_TYPE_ACTIVE;
scanConf.scan_time.active.min = 200;
scanConf.scan_time.active.max = 500;
res = esp_wifi_scan_start(&scanConf, true);
if (res != ESP_OK)
{
Expand Down Expand Up @@ -1122,6 +1124,8 @@ void esp32wifi::StartConnect()
scanConf.channel = 0;
scanConf.show_hidden = true;
scanConf.scan_type = WIFI_SCAN_TYPE_ACTIVE;
scanConf.scan_time.active.min = 200;
scanConf.scan_time.active.max = 500;
esp_err_t res = esp_wifi_scan_start(&scanConf, false);
if (res != ESP_OK)
ESP_LOGE(TAG, "StartConnect: error 0x%x starting scan", res);
Expand Down

0 comments on commit 0a0c6ba

Please sign in to comment.