local function wait_for_connection(timeout_ms) local start = tmr.now() local now local timeout = timeout_ms * 1000 repeat local status = wifi.sta.status() print("status="..tostring(status)) if ip == 5 then -- and ip ~= "0.0.0.0" then return true end tmr.wdclr() now = tmr.now() until (now - start) > timeout return false end function wlan_init(ssid, password) print("WLAN: connecting to SSID:"..ssid..", password="..password) wifi.setmode(wifi.STATION) wifi.sta.config(ssid, password) -- local ok = wait_for_connection(10 * 1000) -- if not ok then -- panic("Could not establish wlan connection, restarting") -- end -- local ip = wifi.sta.getip() -- print("WLAN: Configured, ip="..ip) end