-
-
Notifications
You must be signed in to change notification settings - Fork 757
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
BLE Joystick doesn't work under Android #1563
Comments
unfortunately I'm not qualified enough to talk about the bluetooth stack, but just from general knowledge/intuition: otherwise it might also be unity that can't work with joysticks on android in particular (for whatever reason, but nothing can surprise me anymore when it comes to unity...) |
Yes - so if I pair an Xbox One controller (for example) that is detected and works fine in the sims. I say fine, obviously, it's horrible compared to the sticks on a radio, but it works. |
Ok, let me rephrase my question a little bit, could you test another no-name / cheapo bluetooth controller? The intention is to find out if the bluetooth library that expresslrs uses has some flaw, or if it is android that just for whatever reason doesn't like the library. |
The only bluetooth controller I found which isn't a big brand console controller is made by Sminiker - but seems to act a bit differently. Whist both the Xbox One controller and ExpressLRS Joystick have a little gamepad icon next to them in the Bluetooth setting in Android, the controller shows up as a "S600 Gamepad" with a keyboard symbol and lets me move around icons on the desktop and start up applications. It does get picked up as a joystick in the sim, but I can't pick up any movement from the axis... but probably because it's acting as a keyboard for some weird reason. At this point I've run out of Bluetooth controllers to test though |
I've made a BLE gamepad using an ESP32 with the BLEGamepad library and it works on my android phone (with Curry Kittens sim and FPV Freerider). I've had a quick glance through the code and they're pretty similar, but I'm happy to post my code if someone with an ELRS controller wants to look. |
Yes please, we're happy to take a look at the differences |
Apologies, this is rather clunky as I removed a load of other functionality for this test. The big functional difference I can see with your code is that I had to add some code to only send if a value had changed. Without that (even at 100hz) the controller got more and more laggy until the axis stopped responding. However I just tested without this at 200hz, and for the 20 seconds of my test it worked perfectly. |
I had a similar issue with connecting a BetaFPV LiteRadio 2 (old version) to an Android device over USB. After some research it turns out that Android is very picky about what USB HID game pads it allows, if the HID descriptor doesn't match those criterias it will not show up on Android. For the LiteRadio 2 the problem was that it defines Sim Ctrls/throttle and rudder instead of Generic Desktop Control/X, Y, Z which Android doesn't recognize as a proper gamepad. Maybe something similar applies to Bluetooth too. I see that the BLE code seems to use Throttle/Rudder here: |
Current Behavior
I've tried using the BLE joystick on an Android device. I find that I can connect it to my Android tablet, but I can't get it to appear as a joystick when testing with a sim. I've noticed in the Dsicord group that a few people attempted to use it on Android, and also couldn't seems to get it to work using different sims and a bunch of gamepad testers. In these cases of it failing on Android, it seems absolutely fine on Windows/Mac with the same radio.
Steps to Reproduce
Put your radio/module into BLE joystick mode, pair it with your Android device - attempt to use a SIm - the Sim doesn't see any joystick connected. I was using (and a few of my users) my own CurryKitten FPV Simulator, I saw another using Freerider. Both these sims use Unity as their Game engine. unity doesn't have any special support for bluetooth devices, it simply lists the available joysticks on the system. If a bluetooth device has been paired as a joystick, then it should appear as a joystick in the sim.
Possible Solution (Not obligatory)
I don't know enough about the BlueTooth stack to suggest anything here, but given that the code appears to work fine on Windows/Mac - I assume there's something quite specific about Android that perhaps needs a more specific definition
Details
Your Environment
The text was updated successfully, but these errors were encountered: