Skip to content

Commit 2195109

Browse files
ingframinme-no-dev
authored andcommitted
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.
1 parent 8d938c8 commit 2195109

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: libraries/WiFi/src/WiFiScan.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void* WiFiScanClass::_scanResult = 0;
5454
* @param show_hidden show hidden networks
5555
* @return Number of discovered networks
5656
*/
57-
int16_t WiFiScanClass::scanNetworks(bool async, bool show_hidden, bool passive, uint32_t max_ms_per_chan)
57+
int16_t WiFiScanClass::scanNetworks(bool async, bool show_hidden, bool passive, uint32_t max_ms_per_chan, uint8_t channel)
5858
{
5959
if(WiFiGenericClass::getStatusBits() & WIFI_SCANNING_BIT) {
6060
return WIFI_SCAN_RUNNING;
@@ -70,7 +70,7 @@ int16_t WiFiScanClass::scanNetworks(bool async, bool show_hidden, bool passive,
7070
wifi_scan_config_t config;
7171
config.ssid = 0;
7272
config.bssid = 0;
73-
config.channel = 0;
73+
config.channel = channel;
7474
config.show_hidden = show_hidden;
7575
if(passive){
7676
config.scan_type = WIFI_SCAN_TYPE_PASSIVE;

Diff for: libraries/WiFi/src/WiFiScan.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class WiFiScanClass
3131

3232
public:
3333

34-
int16_t scanNetworks(bool async = false, bool show_hidden = false, bool passive = false, uint32_t max_ms_per_chan = 300);
34+
int16_t scanNetworks(bool async = false, bool show_hidden = false, bool passive = false, uint32_t max_ms_per_chan = 300, uint8_t channel = 0);
3535

3636
int16_t scanComplete();
3737
void scanDelete();

0 commit comments

Comments
 (0)