I've trouble combining wifi.sta.getap and net.createServer(net.TCP).
Now I assume it's not possible to use these both at the same time.
To find out if this is true, I created a small program combining wifi.sta.getap and wifi.sta.getip.
Although the might be called alternating, now a problem with the tmr module arises.
In the program below, the program hangs in the second while loop.
If I do the pieces of code by hand (interactively) and without the while loop, everything works as expected.
thanks Stef
_ap_scan = true
TMR_1 = 1
wifi.setmode ( wifi.STATION )
function _copy_ap ( My_APs )
print ( "........ found APs ", type ( My_APs ) )
_ap_scan = false
end
for i = 1, 5 do
while wifi.sta.getip () == nil do
print ( "IP unavailable, Waiting..." )
tmr.delay ( 1000000 )
end
print ( "Config done, IP is " .. wifi.sta.getip())
_ap_scan = true
wifi.sta.getap ( _copy_ap )
print ( 'ssstrated', _ap_scan )
while _ap_scan do
tmr.delay ( 1000000 )
print ( '......................', _ap_scan )
end
end