:) Yeah, it's not that hard to add a USB-serial converter to it, but doing the wireless programming can be a bit of a pain.
I'd call setServices and setAdvertising immediately on onInit if I were you - and while calling setAdvertising again shouldn't be an issue I'd avoid calling setServices - that'll trigger a softdevice restart which could confuse the Mac.
It sounds a bit like what's happening is the Mac is 'forgetting' that it's a HID device though, so when it connects it doesn't request the HID stuff, and then you get the error when trying to send a keypress. It's possible that now it's working, without the repeated setServices, it'll keep working.
However if you connect again at any point when it's reset, the Mac might see there's no HID and then stop treating it as a HID device - so you'll have to go through that whole remove/pair thing again :(
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.
:) Yeah, it's not that hard to add a USB-serial converter to it, but doing the wireless programming can be a bit of a pain.
I'd call
setServices
andsetAdvertising
immediately ononInit
if I were you - and while calling setAdvertising again shouldn't be an issue I'd avoid calling setServices - that'll trigger a softdevice restart which could confuse the Mac.It sounds a bit like what's happening is the Mac is 'forgetting' that it's a HID device though, so when it connects it doesn't request the HID stuff, and then you get the error when trying to send a keypress. It's possible that now it's working, without the repeated
setServices
, it'll keep working.However if you connect again at any point when it's reset, the Mac might see there's no HID and then stop treating it as a HID device - so you'll have to go through that whole remove/pair thing again :(