Announcement

Collapse
No announcement yet.

Scanning a single channel and modifying refresh timer.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scanning a single channel and modifying refresh timer.

    Leaving this for reference...

    There are additional parameters that can be passed to the WiFi.scanNetworks which includes specifying a single channel. This is useful if you're hunting a rogue access point and you don't want to hop channels and potentially miss a broadcast that could clue you in to it's location.

    The full definition of the function can be found here: https://github.com/esp8266/Arduino/b...66WiFiScan.cpp, and this is the part I was interested in:

    Code:
    int8_t ESP8266WiFiScanClass::scanNetworks(bool async, bool show_hidden, uint8 channel, uint8* ssid)
    The third parameter allows you specify the channel number, so if you modify the source of warcollar.cpp it will look something like the following, which only scans channel 1:

    Code:
    WiFi.scanNetworks(true, true, 1);
    Also, the variable is quite obvious if you look at the code, but you can modify the scan refresh interval if you want something more responsive. Keep in mind that the default code has the results of the previous scan clearing from the terminal, so if the AP you're hunting doesn't broadcast during the scan period it won't show up when it next prints to the screen. I set mine to 3.5 seconds while testing.

    Code:
    #define SCAN_PERIOD 3500
Working...
X