tijmenvangulik/ErgometerJS

BLE driver issues

Closed this issue · 21 comments

I am having a lot of issues with the BLE driver it seems. After connecting I get this log message a lot NotSupportedError: GATT operation failed for unknown reason. After a while it will transmit partial data from the PM5. However not everything there should be and I also get tons of this logged. wrong csafe frame ending.

Any thoughts how to zero in on this bug?

It seems like this might be related: https://bugs.chromium.org/p/chromium/issues/detail?id=664863

I am trying to use the BLE driver on the web. Hardware is my computer which has bluetooth and I am doing that inside chrome.

According to the link I attached in my first comment, it seems like you should serialize the calls to startNotifications.

Windows 10, chrome 81.

It's localhost. Ergometer-space.org has the same issues it seems.

Well ... according to the link, in case you haven't had a chance to look at it. It can cause issues if the startNotifications commands are called in parallel instead of in sequence. And I checked your code, you're doing them all at once.

Well, your promiseAllSync does not actually serialize the execution of the promises. they are just awaited in a different way. The execution is started upon new Promise which is before the promiseAllSync call.

This is not correct. The promise code starts executing immediately after the promise is instantiated. The then code simply means this is called after the promise finished. I have a small fix in my version right now which I'll be trying out today and see if it helps.

Edit: Just try the following code. By your logic, none of the code inside the promises should run, since we don't use any then.

for(let i = 0; i < 10; i++) {
  new Promise(() => console.log(i))
}

Yeah, so this still seems unresolved for me. I tried to run this on my Android phone. and am getting these weird GATT errors.

It is a fairly old phone. You have the latest version from the git repo running on your erg space, no?

I could for the first time repeat the connection problems. Hopefully I can now debug and fix this.

I have published a fix for multi plex mode for android. You can turn on this mode and then it should compensate for limited blue tooth hard ware.

Thanks