Configure WIFI module as AP for 60 seconds, and then switch to STA

  • This idea is feasible.
    1.You can create a separate configuration file, such as/etc/wpa_supplementant.ap.conf,with the following content:

    Code: Select all

    ctrl_interface=DIR=/var/run/wpa_supplicant
    ap_scan=1
    
    network={
        ssid="YourAPSSID"
        mode=2
        frequency=2412
        key_mgmt=NONE
    }
    
    Here mode=2 means creating an AP, frequency=2412 means the frequency is 2.4G.
    2.Reference link https://wiki.luckfox.com/zh/Luckfox-Pic ... E%A5-wifi.,modify the WiFi configuration file in/etc/wpa_supplicant.conf.
    3.Write shell file:

    Code: Select all

    killall -9 wpa_supplicant 
    wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant_ap.conf
    sleep 60
    killall -9 wpa_supplicant 
    killall -9 wpa_supplicant 
    wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf 
    udhcpc -i wlan0