I actually have a very similar problem, but I'm not doing anything with BLE at all (i.e. not trying to save power or anything).
I just pair/connect my Puck to my Win 10 laptop as HID-keyboard and use it to automate a couple of things by pressing the button (just emit key presses).
Here's how I initialize the Puck (the code pretty much straight out of HID tutorial):
var kb = require("ble_hid_keyboard");
NRF.setServices(undefined, { hid : kb.report });
// Define button press handler
function btnPressed(e) {
digitalPulse(LED1,1,50);
// Send some key(s) here...
kb.tap(kb.KEY.ENTER, 0, function() {});
}
function onInit() {
// trigger btnPressed whenever the button is pressed
setWatch(btnPressed, BTN, {edge:"rising",repeat:true,debounce:50});
}
The problem:
Because I often take my laptop and walk away from my desk where the Puck is, BLE connection breaks - this is expected. But when I come back to my desk, the connection never restores by itself. It shows as "paired" but not connected.
I have to open IDE and initiate a connection to the Puck, which works fine, but is a real pain in the bum because this happens a LOT.
Is this normal? My Bluetooth keyboard and headphones reconnect fine, and I would expect the Puck to do the same...
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.
Hello community!
I actually have a very similar problem, but I'm not doing anything with BLE at all (i.e. not trying to save power or anything).
I just pair/connect my Puck to my Win 10 laptop as HID-keyboard and use it to automate a couple of things by pressing the button (just emit key presses).
Here's how I initialize the Puck (the code pretty much straight out of HID tutorial):
The problem:
Because I often take my laptop and walk away from my desk where the Puck is, BLE connection breaks - this is expected. But when I come back to my desk, the connection never restores by itself. It shows as "paired" but not connected.
I have to open IDE and initiate a connection to the Puck, which works fine, but is a real pain in the bum because this happens a LOT.
Is this normal? My Bluetooth keyboard and headphones reconnect fine, and I would expect the Puck to do the same...
Is there anything I can do to fix this?
Thanks.