Wonder if my Mac is at fault - not had problems before.
Probably not - I wonder whether if you pair and unpair then the Mac deletes its pairing key, but the Puck doesn't know it has to so keeps trying to use the old key which might cause problems?
can't see how the Puck knows it is now back in control of a device via HID
You can't easily - you can see it's connected/disconnected via events on NRF, and I guess you could try sending a 'null' HID report and see if it throws an exception to see if HID has been enabled?
Once there's a handler, it'll get called whenever a device connects to Puck.js with a number which is the connection strength. Job done.
You might also want to look at http://www.espruino.com/Reference#l_NRF_setConnectionInterval - you could set this to something lowish (like 500ms) which reduces the activity on the BLE connection. It'll reduce the rate that the setRSSIHandler callback gets called and will help save the Puck and iOS device's battery
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.
Probably not - I wonder whether if you pair and unpair then the Mac deletes its pairing key, but the Puck doesn't know it has to so keeps trying to use the old key which might cause problems?
You can't easily - you can see it's connected/disconnected via events on
NRF
, and I guess you could try sending a 'null' HID report and see if it throws an exception to see if HID has been enabled?It's just this: http://www.espruino.com/Reference#l_NRF_setRSSIHandler
Once there's a handler, it'll get called whenever a device connects to Puck.js with a number which is the connection strength. Job done.
You might also want to look at http://www.espruino.com/Reference#l_NRF_setConnectionInterval - you could set this to something lowish (like 500ms) which reduces the activity on the BLE connection. It'll reduce the rate that the setRSSIHandler callback gets called and will help save the Puck and iOS device's battery