The latest development version of this page may be more current than this released 0.4.0 version.

fast_scan

Overview

This example demonstrates how to use Wi-Fi to quickly scan the functional connection AP.

It supports fast scan and full channel scan.

  • Fast scan : In this mode, the scan ends as soon as a matching AP is detected, even if the channel is not fully scanned. You can set a threshold for signal strength and select the desired authentication mode provided by the AP. The Wi-Fi driver will ignore aps that do not meet the above criteria.

  • Full channel scan : Only end when the scan is complete. The ranking method of aps includes signal strength and authentication mode. After scanning, the Wi-Fi driver selects the most suitable AP.

After scanning, Wi-Fi will try to connect. In most cases, the AP with the best signal strength is connected.

Requirements

  1. A properly connected AP is required.

  2. Configure WiFi SSID and WiFi Password in menuconfig .

Building and flashing

Example Location: examples/wifi/fast_scan

compile, burn, and more, see: get started

Running result

Successfully running will output the following logs

D/main            [0.002] boot reason 0
D/main            [0.004] heap size 270856(264.51KB)
D/fls             [0.010] flash size 0x200000(2MB)
D/ptb             [0.014] partition table base 0x800e000
D/ft              [0.020] ft_0 base 8000000, ft_1 base 8001000
D/ft              [0.026] ft init too
D/ft              [0.030] ft init error
E/nvs             [0.034] use new hash entry num=53

I/fast scan       [2.248] fast_scan finished.
D/wifi            [7.218] distribution event 1
D/wifi            [7.222] sta connected 42-C1-82-80-2A-15 channel 6 authmode 3
I/fast scan       [8.046] got ip: 192.168.3.102
D/wifi            [8.050] distribution event 0
D/wifi            [8.056] sta got ip 192.168.3.102