Are you using the 1v90 firmware (or even better, the one I posted up in response to the issues with uncaught promises) on both devices?
What you've done looks good...
I've never seen error code 12290 before though! All I can think is that perhaps the connection broke down before the service could be found.
... and I just looked it up (nRF errors can be tricky to find, but it's BLE_ERROR_INVALID_CONN_HANDLE)... So it seems like that's likely the problem - the connection broke down while the services were being scanned. It also explains why the disconnect failed.
The BLE communications aren't totally reliable, so you have to expect that things will fail occasionally - however 1 in 2 times does seem a bit high.
Does it work more reliably when you're not connected to the first Puck with your PC? It's possible that all the communications between it in the PC (~50 packets per second) are making it less able to communicate with the other Puck.
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.
Are you using the 1v90 firmware (or even better, the one I posted up in response to the issues with uncaught promises) on both devices?
What you've done looks good...
I've never seen error code 12290 before though! All I can think is that perhaps the connection broke down before the service could be found.
... and I just looked it up (nRF errors can be tricky to find, but it's BLE_ERROR_INVALID_CONN_HANDLE)... So it seems like that's likely the problem - the connection broke down while the services were being scanned. It also explains why the
disconnect
failed.The BLE communications aren't totally reliable, so you have to expect that things will fail occasionally - however 1 in 2 times does seem a bit high.
Does it work more reliably when you're not connected to the first Puck with your PC? It's possible that all the communications between it in the PC (~50 packets per second) are making it less able to communicate with the other Puck.