-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[settings] "Make Connectable" appears to not setup blerepl #3771
Comments
@gfwilliams does this sound like anything you've seen before? |
That's very strange indeed...
How do you do that? Just hold the button for a few seconds? Because I guess you can't connect to call Would it have been just an app reload, or a full hardware reboot?
So this happened once, and you haven't been able to reproduce it since? I guess there is also the possibility it was a glitch in the Bluetooth driver of the device you were connecting with? |
Yes exactly - the equivalent to
It happens if I haven't connected in a while, but otherwise I'm unable to say why - I've tried just now and it connected as expected. Will narrow it down next it happens |
Thanks - it may be a hard one to track down - but one reason you might not get a response on the BLE UART is that the Bangle is busy doing something (like compacting?) that means it can't respond... So maybe that could be it? |
Bug reproSo I believe the cause might be gadgetbridge messages. The bug happened again and I got this in the web console: Console output when bug occurs
The crucial part being:
However, if I attach the IDE, then attach the App Loader (to see at least the bangle's output in parallel), the IDE connection succeeds and I see this in the IDE:
Then when the App Loader connects, it (presumably) multiplexes/shares the existing connection created by the IDE, so the GB messages aren't resent, so the App Loader isn't tripped up and works. I confirmed this by disconnecting entirely, then only connecting the App Loader, and the bug appears again. So I suspect the GB messages are tripping up the app loader. Attempted RemediesI further attempted to remedy this by:
The only method that I know to work:
|
Hi - thanks! So looking at the code the app loader sends, you can see it says to output Please can you try: I'd be interested to see how long that takes - I guess if you did a compact it would probably solve the problem but we shouldn't have to rely on that. Right now the app loader is dependent on the Puck.js library and its default timeout. I can look at adding a change so that we can increase it, but right now the timeout appears to be 10 seconds which is quite a lot! Actually what firmware version do you have? If it's a cutting edge one from a week or so ago please can you try upgrading? I made some changes to how characters coming over Bluetooth are handled and I know that for a few days I did have a firmware build that occasionally dropped characters - but that should be fixed now. |
Sure: >t=getTime();require("Storage").list(/\.info$/);print(getTime()-t)
0.12075805664 I don't think it's a timeout issue though - when I connect the App Loader it works fine if there's already a connection established to the watch (via another tab). If it were a timeout, we'd see the problem regardless, when the App Loader lists the files, right? Issue example (GB messages)I believe it's the GB messages (the initial ones) that are confusing the App Loader and can confirm this via:
Found BANGLEJS2, 2v25
Connected to Web Bluetooth, Bangle.js 65f0
{"t":"status","bat":89,"chg":0}
{"t":"ver","fw":"2v25","hw":2}
{"t":"force_calendar_sync","ids":[]}
>a=require("android")
={
gbSend: function (message) { ... },
gbHandler: function (event) { ... },
httpHandler: function (url,options) { ... },
overwriteGPS: function () { ... },
actInterval: undefined }
>a._gbSend = a.gbSend
=function (message) { ... }
>a.gbSend=()=>{}
=function () {}
Disconnected from Web Bluetooth, Bangle.js 65f0
Found BANGLEJS2, 2v25
Connected to Web Bluetooth, Bangle.js 65f0
>a.gbSend = a._gbSend
=function (message) { ... }
Disconnected from Web Bluetooth, Bangle.js 65f0
|
Thanks for tracking it down! So my guess would be that the Puck.js library
So it's a tricky one. I'm not sure I can just clear the input buffer right after we've sent the last bit of the command as if the command contains newlines then it might have created output while it was being sent over. We could use some delimiting characters like What I might try is to only check for a newline when one is received (so even if the input buffer contained a newline from previously received data we ignore it). Hopefully that won't break anything that's using the Puck.js lib but we'll see |
I'm hoping I've fixed this now - definitely seems more reliable. In the end I added a bit of a hack to search all received data for the line that stars with |
Awesome - just tried the new app loader and it worked first time, thanks for the fix! |
Affected hardware version
Bangle 2
Your firmware version
2v25
The bug
If I have bluetooth off and want to use the Bluetooth menu's "Make Connectable" to enable it, this turns on bluetooth but I can't connect with the IDE or the App Loader - I'm presented with the following:
No response from device. Is 'Programmable' set to 'Off'?
To resolve this, I must restart the watch (as in,
load()
) at which point the IDE/App Loader can connect.It appears that the effects of setting
blerepl
are applied by "Make Connectable" so I'm puzzled as to why the reset is required.To make things more interesting, attempting to reproduce this after the fact doesn't raise the bug - turning off bluetooth, resetting, then using "Make Connectable" works fine.
Installed apps
No response
The text was updated successfully, but these errors were encountered: