-
-
Notifications
You must be signed in to change notification settings - Fork 915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix bluetooth support issue for chrome on android #4227
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for origin-betaflight-app ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
same result as @PSi86 |
@PSi86 @nerdCopter The original UI code has some issues for portrait mode on small screens. So just use landscape mode and the port select will display. |
That's an issue. The serial usb polyfill works on my old android phone but fails on my new android 14 phone. On my phone I have an workaround, by using a native app to open the serial port,and then close it. The bluetooth is tested on android 14 with a speedybee bluetooth fc, and it works well. |
and usb otg serial support for chrome on android. Update src/js/protocols/bluetooth.js Co-authored-by: Mark Haslinghuis <[email protected]>
db51820
to
8a51391
Compare
Co-authored-by: Mark Haslinghuis <[email protected]>
Hi all, |
Co-authored-by: Mark Haslinghuis <[email protected]>
src/js/webSerial.js
Outdated
if(this.port.addEventListener){ | ||
this.port.addEventListener("disconnect", this.handleDisconnect.bind(this)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a bug? Why make this conditional as this removes disconnect event listener if true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the polyfill, the SerialPort class doesn't implement EventTarget, and the disconnent event will only be emitted by the Serial class.
In the configurator code, webSerial listens on both, however, it might not be essential. as the gui code would call disconnect in the disconnect event callback from the Serial class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without the test, there will be an exception thrown here.
This fix works for some Android devices but not all of them. Was thinking capacitor was going to fix mobile usage of the app - but needs attention. |
Co-authored-by: Mark Haslinghuis <[email protected]>
Yes, this fix gets some limitations. might be a candicate for the pwa. but should be better to use a native wrapper. |
This solution was tried here before #3948 and adding the library in the package file (here it has been manually added). But as you say it only works for some old devices and I think remember it didn't implement all the events we use so is not a complete solution neither. We decided to go for a "complete" solution, with the use of Capacitor #3955 so the correct solution is to search for a library compatible with Capacitor and use it when executing in Android. Was in my TODO list but I've no time at this moment. |
The bluetooth part works well on chrome on android. So I think it's not bad to make it available for the PWA, and leave the full feature as a Capacitor app. |
If bluetooth works in all / the major part of Android devices, it's ok for me to add this. I suppose that we will need to add the library later to be compatible with Apple devices, but this is a war for the future. But for usb / serial devices, I think we need to add Capacitor for Android. |
Quality Gate passedIssues Measures |
Fix bluetooth support issue for chrome on android
Add usb otg serial support for chrome on android.
Bluetooth verified with speedybee bluetooth fc on android 14.
Serial polyfill works on android 11, fails on android 14.
The reason might be this. #4227 (comment)