Realiable WiFi using PYBD
Posted: Thu Jul 25, 2019 10:24 pm
Hi MicroPython community,
First, thanks for making something awesome as MicroPython happen! It really makes my software engineer heart really warm and cozy!
I use my SF2W since some weeks to log data to a MQTT server. This works nice and rather reliably. However, when my WiFi disappears my Python script gets stuck and remains so after connecting. I tried to make it more reliable, but was not really able to.
I tried with something like this in my main loop:
[code]
if not wl.isconnected():
errled.on()
wl.disconnect()
wl.connect(...)
while not wl.isconnected():
time.sleep_ms(200)
[/code]
However, from what I can see wl.isconnected() never gets True in those situation.
Enabling tracing seems to indicate that the lower layer connects, but it seems not to be reflected on the Python API:
[code]
[ 884015] ASYNC(0000,32,0,0,0)
[ 884018] ASYNC(0000,ASSOC_REQ_IE,0,0,0)
[ 884018] ASYNC(0000,AUTH,0,0,0)
[ 884040] ASYNC(0000,ASSOC_RESP_IE,0,0,0)
[ 884040] ASYNC(0000,9,0,0,0)
[ 884040] ASYNC(0001,LINK,0,0,0)
[ 884049] ASYNC(0000,PSK_SUP,6,0,0)
[ 884114] ASYNC(0000,JOIN,0,0,0)
[ 884115] ASYNC(0000,125,0,0,0)
>>> wl.status()
-2
>>> [ 888723] ETHRX len=152 dst=... src=.... type=IPv4 srcip=.... dstip=..
>>> wl.isconnected()
False
[/code]
I also found this which claims that PYBD should automatically reconnect:
https://github.com/peterhinch/micropyth ... /pyboard_d
This seems not true/have issues?
Banner says I am using:
MicroPython v1.10-445-ga9b1d3ca3 on 2019-05-29; PYBD_SF2W with STM32F722IEK
Which I think is the latest version? (at least banner did not change after reflashing some minutes ago. But *please* add version information to the PYBD builds in your downloads section...)
Best regards,
Stefan
First, thanks for making something awesome as MicroPython happen! It really makes my software engineer heart really warm and cozy!
I use my SF2W since some weeks to log data to a MQTT server. This works nice and rather reliably. However, when my WiFi disappears my Python script gets stuck and remains so after connecting. I tried to make it more reliable, but was not really able to.
I tried with something like this in my main loop:
[code]
if not wl.isconnected():
errled.on()
wl.disconnect()
wl.connect(...)
while not wl.isconnected():
time.sleep_ms(200)
[/code]
However, from what I can see wl.isconnected() never gets True in those situation.
Enabling tracing seems to indicate that the lower layer connects, but it seems not to be reflected on the Python API:
[code]
[ 884015] ASYNC(0000,32,0,0,0)
[ 884018] ASYNC(0000,ASSOC_REQ_IE,0,0,0)
[ 884018] ASYNC(0000,AUTH,0,0,0)
[ 884040] ASYNC(0000,ASSOC_RESP_IE,0,0,0)
[ 884040] ASYNC(0000,9,0,0,0)
[ 884040] ASYNC(0001,LINK,0,0,0)
[ 884049] ASYNC(0000,PSK_SUP,6,0,0)
[ 884114] ASYNC(0000,JOIN,0,0,0)
[ 884115] ASYNC(0000,125,0,0,0)
>>> wl.status()
-2
>>> [ 888723] ETHRX len=152 dst=... src=.... type=IPv4 srcip=.... dstip=..
>>> wl.isconnected()
False
[/code]
I also found this which claims that PYBD should automatically reconnect:
https://github.com/peterhinch/micropyth ... /pyboard_d
This seems not true/have issues?
Banner says I am using:
MicroPython v1.10-445-ga9b1d3ca3 on 2019-05-29; PYBD_SF2W with STM32F722IEK
Which I think is the latest version? (at least banner did not change after reflashing some minutes ago. But *please* add version information to the PYBD builds in your downloads section...)
Best regards,
Stefan