CurryKitten / CurryKitten-Sim

FPV quad simulator
67 stars 7 forks source link

Yet another rewrite of the Joystick mapping/calibration needed #62

Closed CurryKitten closed 3 years ago

CurryKitten commented 4 years ago

After including the ability to fly a plane in the sim, I'm feeling that the control remapping is a bit lengthy and unflexible. It works ok, but isn't very good if a user just wants to tweak one control. Right now the calibration insists that you move every axis/switch that you might use and the remap will currently ask you for 8 inputs.

I think this is fine as a 1st time setup, call it the calibration wizard and the remap wizard. Because adding the word wizard seems to allow you to suggest it's all encompassing but you might need to go and customize things later.

My plan here is to do something with the radio debug screen (also rename it as it's not debug, it'll be "customization", or "advanced setup" or something.

From here I want to let users calibrate and remap individual channels. To remap a channel when we know what it's input it means instead of asking the user to move a stick for roll, you'd have a dropdown to select "roll" (or whatever) from an axis that we know about.

I also need to extend the debug screen to show all the available axis and buttons. I might think about remapping buttons as well - but just in this mode, not from the wizard - given that some USB dongles look like they are pressing buttons non-stop

CurryKitten commented 3 years ago

Started work on this. Going to use a dynamically generated UI depending on the number of axis/buttons the user has which may be a scrollable list depending on the size. Pan is to add a Map control/Calibrate button to each of the axis with just a map control button to each of the buttons (as you can't calibrate a button)

CurryKitten commented 3 years ago

Screenshot 2020-11-18 at 17 10 21

Been working on the UI and functionality for this. So far, the dynamically scaling screen to accommodate all the buttons/axis is done and we detect this correctly from the joystick. At present, we can assign/deassign/reassign various actions to axis. I just need to duplicate this on buttons and then think about how to do a single axis calibration function that needs to have the additional option of not taking a centre point (for things like throttle sticks, 2 position switches, and analog shoulder buttons on game controllers)

CurryKitten commented 3 years ago

Ok, marking this as done, and it'll go into the 0.51b release that's coming up shortly. After much testing, I was left with a single annoyance I can't do much about.

Rewired knows about the USB HID data, but it doesn't expose it to the API, instead, it just uses it to match up a known controller map with what's been plugged in. Whilst it does a great job with regular joysticks, like Playstation and Xbox controllers, all radios get mapped to the "Unknown controller" This has 32 Axis and 256 buttons. I've talked to the Rewired developer and it essentially comes down to is a difference of opinion about how I would like to visualise a joystick/radio and how he does. Obviously, I think I'm right - but it's his code, and if he did alter the code it's not going to be for a long time because of other commitments.

So in the meantime, it's a little bit hacky, but we have some workarounds. Firstly for a unknown joystick I limit the number of buttons/axis to 32 each. If the radio is a Taranis style joystick, then I can override it to the correct 8 axis and 24 buttons. I'm not sure how things like RadioMaster radio show themselves, but the BetaFPV controller and the Jumper T12 Pro both described themselves as a "Taranis" controller, so here's hoping.