You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
at the line below the example waits for the connected client to disconnect.
What is not obvious is that awaiting this disconnected() call causes an disconnect after 60 seconds!
It took me a long time reading code before I found the reason why: The timeout_ms parameter for the disconnected() call specifies a default timeout of 60 seconds for the wait, after which a CancelledError is raised, and the peripheral_task() exits, disconnecting the connection.
which will push change notifications to the connected client every 5 sec or so, and not disconnect mysteriously (for micropython noobs like me in any case) after 60 seconds.
I can make a PR for this if desired.
The text was updated successfully, but these errors were encountered:
at the line below the example waits for the connected client to disconnect.
What is not obvious is that awaiting this
disconnected()
call causes an disconnect after 60 seconds!micropython-lib/micropython/bluetooth/aioble/examples/temp_sensor.py
Line 58 in 8058b29
It took me a long time reading code before I found the reason why: The
timeout_ms
parameter for thedisconnected()
call specifies a default timeout of 60 seconds for the wait, after which aCancelledError
is raised, and theperipheral_task()
exits, disconnecting the connection.micropython-lib/micropython/bluetooth/aioble/aioble/device.py
Line 218 in 8058b29
regrettably neither the CancelledError or the stacktrace give any clear indication of what happened.
As this is example code it might be nice to change the example to this instead:
which will push change notifications to the connected client every 5 sec or so, and not disconnect mysteriously (for micropython noobs like me in any case) after 60 seconds.
I can make a PR for this if desired.
The text was updated successfully, but these errors were encountered: