-
• #2
Which device is "BUSY"??
I guess it is bluetoooth stack on Puck that is BUSY - the
return g.getPrimaryService(primaryServiceUuid);
fail for some reason. Could it be that this code is running multiple times or there is something else BLE related running on Puck at the same time? -
• #3
Hi! I'm pretty sure you've his exactly this issue that was reported a few days ago: http://forum.espruino.com/conversations/363920/#comment15998892
I have no idea why this has happened yet but I will look into it very soon. For the moment you can almost certainly fix it by changing:
return device.gatt.connect(); }).then(function(g) { logMsg += "Connected\n"; digitalPulse(LED3,1,10); gatt = g; return g.getPrimaryService(primaryServiceUuid); }).then(function(service) {
to:
return device.gatt.connect(); }).then(function(g) { logMsg += "Connected\n"; digitalPulse(LED3,1,10); gatt = g; return new Promise(r => setTimeout(r,500)); //< ---------- added this delay }).then(function() { return gatt.getPrimaryService(primaryServiceUuid); }).then(function(service) { ...
-
• #4
Thank you @Gordon!! That was it! And thanks for forwarding the other issue, I did a search on the forums for BLE Error 11 and I get no hits (not even this post).
And @fanoush... thank you too! You have inspired me to order both an F07 and a DK08 to flash into Espruinos. I'm trying to work up the courage to make a build for PineTime. It's been a LONG time since i've worked at device level (hence my preference for JS on MCUs) but you've done considerable heavy lifting already. I've learned a lot from you both!
-
• #5
Just to add I tried to reproduce this with recent firmware, but can't. I wonder whether there's something about the Bangle.js's configuration that's non-standard (like having bonding enabled somehow?).
-
• #6
Ok, I figured it out (I think). This is due to negotiation of a higher MTU since this was added in Espruino 2v09.
I think if you're connecting to a device with an older firmware you can connect just fine. It's when you connect between two devices with 2v09+ firmware that you have the issue. Follow this on the GitHub issue.
-
• #7
I did a search on the forums for BLE Error 11 and I get no hits (not even this post).
you need to turn off
Title matched search terms
filter which is preselected
Hey all, I'm a little lost here. My Bangle is running a watchface that is listening on a specific UUID for short strings to act as notifications (not BLE notifications, just messages). The Bangle code works fine, and I can access it from both a Web Bluetooth page and a DroidScript app. However, I can't get my puck to send the message properly. Here is the Bangle (peripheral) code snippet:
The showMsg() function is defined and works fine (just draws a dialog box and writes the string to screen).
Here is the Puck code (mostly thanks to Gordon's BLE example):
Which works fine in an HTML page using "let NRF = navigator.bluetooth;"
I'm writing my log to a file since console is disabled when I run this, and the file reads:
As i said, I know the Bangle code works, been using it for weeks. The Puck code runs in a browser just fine. Which device is "BUSY"?? Any help appreciated!