From 2195109ecc0c7bdfa17cc60aa5a03ae78ed87205 Mon Sep 17 00:00:00 2001 From: Franco Minucci Date: Mon, 20 Jan 2020 15:13:10 +0100 Subject: [PATCH] Added the channel parameter to the scan fucntion in order to select which channel to scan. (#3638) The default value is 0 (= all channels) to preserve backward compatibility. --- libraries/WiFi/src/WiFiScan.cpp | 4 ++-- libraries/WiFi/src/WiFiScan.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/WiFi/src/WiFiScan.cpp b/libraries/WiFi/src/WiFiScan.cpp index cabedbb8..7c6254fc 100644 --- a/libraries/WiFi/src/WiFiScan.cpp +++ b/libraries/WiFi/src/WiFiScan.cpp @@ -54,7 +54,7 @@ void* WiFiScanClass::_scanResult = 0; * @param show_hidden show hidden networks * @return Number of discovered networks */ -int16_t WiFiScanClass::scanNetworks(bool async, bool show_hidden, bool passive, uint32_t max_ms_per_chan) +int16_t WiFiScanClass::scanNetworks(bool async, bool show_hidden, bool passive, uint32_t max_ms_per_chan, uint8_t channel) { if(WiFiGenericClass::getStatusBits() & WIFI_SCANNING_BIT) { return WIFI_SCAN_RUNNING; @@ -70,7 +70,7 @@ int16_t WiFiScanClass::scanNetworks(bool async, bool show_hidden, bool passive, wifi_scan_config_t config; config.ssid = 0; config.bssid = 0; - config.channel = 0; + config.channel = channel; config.show_hidden = show_hidden; if(passive){ config.scan_type = WIFI_SCAN_TYPE_PASSIVE; diff --git a/libraries/WiFi/src/WiFiScan.h b/libraries/WiFi/src/WiFiScan.h index 3ddcbeac..1929e466 100644 --- a/libraries/WiFi/src/WiFiScan.h +++ b/libraries/WiFi/src/WiFiScan.h @@ -31,7 +31,7 @@ class WiFiScanClass public: - int16_t scanNetworks(bool async = false, bool show_hidden = false, bool passive = false, uint32_t max_ms_per_chan = 300); + int16_t scanNetworks(bool async = false, bool show_hidden = false, bool passive = false, uint32_t max_ms_per_chan = 300, uint8_t channel = 0); int16_t scanComplete(); void scanDelete();