Espruino Hub installed OK, but Bangle connect fails often #2389
Replies: 10 comments
-
Posted at 2020-07-13 by @gfwilliams What's the unexpected response you're getting?
Could the But in general you would expect the connection to fail sometimes, especially as you'll be connected to Bangle.js via Bluetooth already so it's trying to juggle connecting, but also doing communications with the host PC at the maximum datarate it can handle. Also Bangle.js's bluetooth range isn't actually that great, so I guess that could cause you issues as well. I'd be interested to know whether it's actually any more reliable when you're not connected by PC, or if you run |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-07-13 by gerardwr The contents of "buffer" was expected, so apologies that I have mislead you with my post. When tested:
The error that bugs me the most is Because I had this error many times too when I coded my own BLE-UART-client on Bangle i.c.w. my own coded BLE-peripheral-server on an ESP32 (ref. in my post above). Thought it was due to my inexperience with Espruino and BLE. Now I'm using your code on Bangle and on Raspberry the same error appears, that gives me a little more confidence in my own coding skills ;-) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-07-13 by gerardwr Ok, so I added
Selection from output
The dreaded "Unhandled promise rejection ..." is still prominently present, with a scarce "BLE busy..". |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-07-14 by @gfwilliams
Yes, what that means is the Bluetooth link got terminated while Espruino was waiting for something else to finish (getting characteristics/etc). The disconnect is coming from a pretty low level in the Bluetooth stack, so I'm pretty confident it's not some bug in Espruino itself that causes the disconnect. I guess it's possible some setting could be tweaked to make the connection more error tolerant, but I'm afraid I am yet to find anything that it seems would help. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-07-14 by gerardwr Ok, thanks. Now I know at least that I did not cause the error in my own code. My knowledge about BLE is rather scarce, so I'm afraid that I can't help you there. But I'm good at testing, so if you need my help at some point ........ |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-07-14 by gerardwr As an intermezzo I tried the Bangle.js App Loader from https://github.com/espruino/BangleApps. Wanted to use it as a "simple" file uploader, but so far I can see the current code does not support that. As an experiment I copied the
When I executed it I got the dreaded 'Unhandled Prmise Rejection`, there's no escaping it ;-)
Not sure if this error message is interesting for you, but here it is. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-07-16 by @gfwilliams Hmm - so those Promise rejections are coming from the PC, not the Bangle :) If it happens all the time I'd guess maybe it's something in the code you're uploading that causes the Bangle to drop the connection? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-07-16 by gerardwr Yes, in this case it seems it's coming from node coming from the Espruino Hub on Arduino. But it's not PC-only, as my selfcoded BLE-peripheral on an ESP32 has the And the Bangle code from post #4 has no "code" at all, it's just a httprequest, so thta's not it either. BTW Espruino code on a bare NRF52832 (version 1V97) i.c.w. the Espruino Hub also has the same error. Beats me! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-02-15 by user125378 I know this is an old thread, but it's almost the only thing I can find on the subject. I'm facing the same problem, any way to catch the unhandled promise rejection? - Just so I can error correct myself. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-02-15 by @gfwilliams So you're using the You should just be able to do:
But if that fails, there is also the |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-07-10 by gerardwr
Hi,
I installed Espruino Hub on my RPi, and loaded the example code (added a setInterval) from https://www.espruino.com/BLE+HTTP+Proxy on my Bangle.
Sometimes the Bangle gets the expected response from the Hub, sometimes I get error
Uncaught Error: Unhandled promise rejection: Disconnected
.I got similar errors when I used my own code in the Bangle and a self-coded BLE server on my Esp32 (ref http://forum.espruino.com/conversations/349804/#comment15369436);
Could this be caused be an "issue" in the BLE handling of Espruino, or is it unreliability in the BLE protocol?
Beta Was this translation helpful? Give feedback.
All reactions