Pyboard-D BLE unsolicited disconnects on handle 65535
I have reported this on the forum, but think maybe it is a bug and so reporting it here.
I am getting 'unsolicited' disconnect interrupts with handle 65535, this will happen for sure if a device is connected and you do a soft reboot, it appears that during the restart the device is disconnected but as it does not have a valid handle for the new session, that it will trigger this event.
But I also get it intermittently without a restart, and immediately following this 65535 disconnect, the next connection will fail.
There is mistake in BLE simple central when disconnect is called
There is code in git:
https://github.com/micropython/micropython/blob/41ed01f1394ea608bf9d055120d671e2765cd9b7/examples/bluetooth/ble_simple_central.py#L181-L185
I used that code and my device never disconnected, I found problem in "if" condition and change it to following code, which works for me:
def disconnect(self):
if self._conn_handle is None:
return
self._ble.gap_disconnect(self._conn_handle)):
self._reset()