• Uncaught InternalError: BLE task completed that wasn't scheduled (3/0)

    Yes, it 's a bug in the 2v04 firmware. If you install 2v05 it should work fine

    But it should be harmless as you say -with the gattserverdisconnected handler you should be fine. Does it not work?

    I tried adding a handler in NRF.on('disconnect')... but that doesn't seem to be called

    No, that one is called when a device disconnects from Espruino, rather than the other way around :)

    Is this the neatest way of handling this scenario?

    I think that's a nice easy solution. I think rather than a connected flag you could even use devcie.connected : http://www.espruino.com/Reference#l_Blue­toothDevice_connected

    You could respond to gattserverdisconnected and setTimeout a reconnect, but then you'll have to cope with rescheduling that if the reconnect fails. The setInterval is easy

    Only thing I'd say is 3 secs might be a bit tight - I think there's a possibility that some devices could almost take 3 seconds to connect, and then you might get an error when you tried to connect a second time while in the process of connecting.

About

Avatar for Gordon @Gordon started