As the title says... Chat on...

User avatar
By electr0dave
#66251 I have been analyzing the wifi packets using airpcap and wireshark.

I see that whenever ESP starts, it takes +- 2s to do something that then culminates in Deauthentication.

Can someone explain to me why this happens?

I wanted to make a faster connection to the AP ... but it always takes more than 2 seconds to have a connection ...

Image


Code: Select alllocal W_cfg = {ssid = "dlink"}

function STA_connection()
    print("*** Start STA connection")
   
    wifi.setmode(wifi.STATION)
    wifi.sta.config(W_cfg)
end

function STA_normal_mode()
    print("************************************ STA normal mode")
   
    tmr.unregister(0)

    STA_connection()
   
    wifi.eventmon.register(wifi.eventmon.STA_GOT_IP, function(T)
        tmr.unregister(0)
                   
        print("IP (STA): "..wifi.sta.getip())

        IP_broadcast = wifi.sta.getbroadcast()
       
        E_macADD = wifi.sta.getmac()
        print("MAC (STA):"..E_macADD)

        inc = 0

         tmr.alarm(0, 5000, tmr.ALARM_AUTO,
            function()
                tmr.unregister(0)

                print("DISCONNECT")
               
                wifi.sta.disconnect()

                wifi.setmode(wifi.NULLMODE)

                tmr.alarm(0, 5000, tmr.ALARM_AUTO,
                    function()
                        print("RESTART")

                        STA_normal_mode()
                       
                    end)
            end)
    end)
end
-------------------------------

uart.setup(0, 115200, 8, uart.PARITY_NONE, uart.STOPBITS_1, 1)
print("*** INIT ***\n\n")

STA_normal_mode()