the value gatt.connected should represent the status of the connection in such a way that if a disconnection event is seen, the gatt.connectedshould be set to false
Yes - however the disconnected event executes in the main thread, while connected is set to false in the Interrupt, so the two can be out of sync.
But actually the problem in this case is my advice. What you actually want is:
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes - however the disconnected event executes in the main thread, while
connected
is set tofalse
in the Interrupt, so the two can be out of sync.But actually the problem in this case is my advice. What you actually want is:
The event you hooked into is for when the PC disconnects from the Puck, not when the Puck disconnects from some other device