edgetx
edgetx copied to clipboard
feat(joystick) add support for Android gamepad features
here be dragons - diverse tests required, USB HID support is sometimes ... picky
enhancements to the USB joystick - all Google mandated features for Android gamepads, except for the back key, are supported
- new sim axis Accelerator (Acc), Break (Brk) and Steering (Steer)
- new sim axis D-pad (dpad) also known as HAT switch
- new joystick circular cutout mode "X-Y, Z-rZ"
- mixing physical axis and sim axis now works
- buttons are sparse - no need to configure buttons 0-5 if you only need button 6 or do remapping on the host
For Android use the USB Joystick Mode "Advanced" with "If.mode" Gamepad:
EdgeTX | Android | Linux | USB HID |
---|---|---|---|
axis X | left axis X | ABS_X | X |
axis Y | left axis Y | ABS_Y | Y |
axis Z | left axis X | ABS_Z | Z |
axis rotZ | left axis Y | ABS_RZ | Rz |
sim Acc [^1] | right trigger | ABS_GAS | Accelerator |
sim Brk [^1] | left trigger | ABS_BRAKE | Break |
sim HAT [^2] | D-pad | ABS_HAT0X / ABS_HAT0Y | Hat Switch |
button 0 | A | BTN_SOUTH | Button 1 |
button 1 | B | BTN_EAST | Button 2 |
button 2 | C [^3] | BTN_C | Button 3 |
button 3 | X | BTN_NORTH | Button 4 |
button 4 | Y | BTN_WEST | Button 5 |
button 5 | Z [^3] | BTN_Z | Button 6 |
button 6 | left shoulder button | BTN_TL | Button 7 |
button 7 | right shoulder button | BTN_TR | Button 8 |
button 8 | L2 [^3] | BTN_TL2 | Button 9 |
button 9 | R2 [^3] | BTN_TR2 | Button 10 |
button 10 | select [^3] | BTN_SELECT | Button 11 |
button 11 | start [^3] | BTN_START | Button 12 |
button 12 | mode [^3] | BTN_MODE | Button 13 |
button 13 | left stick click | BTN_THUMBL | Buton 14 |
button 14 | right stick click | BTN_THUMBR | Button 15 |
notes:
- translation work required
- TR_VUSBJOYSTICK_CH_SIM has 4 additional values for the new axis
- TR_VUSBJOYSTICK_CIRC_COUTOUT has 1 additional value for the new circular cutout mode
- button numbering between EdgeTX and the USB HID standard is off by one, resolving that would likely be a breaking change in the UI
- is based on the battery capacity pull request #4602
[^1]: triggers - check EdgeTX/edgetx-user-manual#11 how to feed these half axis [^2]: D-pad - check EdgeTX/edgetx-user-manual#11 how to feed this special axis [^3]: these do work on most Android devices, however their support isn't mandatory
SE translation: #define TR_VUSBJOYSTICK_CH_SIM "Ske","Hjd","Rod","Gas", "Acc", "Brms", "Styr","dpad"
Suggested layouts for tests:
channel | Android | Betaflight | Dualsense | EdgeTX pre 2.9 | EdgeTX Classic |
---|---|---|---|---|---|
CH1 | axis X | axis X | axis X | axis X | axis X |
CH2 | axis Y | axis Y | axis Y | axis Y | axis Y |
CH3 | axis Z | axis Z | axis Z | axis Z | axis Z |
CH4 | axis rotZ | axis rotX | axis rotZ | axis rotX | axis rotX |
CH5 | sim Brk | axis rotZ | axis rotX | axis rotY | axis rotY |
CH6 | sim Acc | axis rotY | axis rotY | axis rotZ | axis rotZ |
CH7 | - | axis Slider | - | axis Slider | axis Slider |
CH8 | sim Dpad | axis Dial | sim Dpad | axis Slider | axis Dial |
CH9 | button 0 | button 0 | button 0 | button 0 | button 0 |
CH10 | button 1 | button 1 | button 1 | button 1 | button 1 |
CH11 | - | button 2 | button 2 | button 2 | button 2 |
CH12 | button 3 | button 3 | button 3 | button 3 | button 3 |
CH13 | button 4 | button 4 | button 4 | button 4 | button 4 |
CH14 | - | button 5 | button 5 | button 5 | button 5 |
CH15 | button 6 | button 6 | button 6 | button 6 | button 6 |
CH16 | button 7 | button 7 | button 7 | button 7 | button 7 |
CH17 | button 8 | - | button 8 | button 8 | button 8 |
CH18 | button 9 | - | button 9 | button 9 | button 9 |
CH19 | button 10 | - | button 10 | button 10 | button 10 |
CH20 | button 11 | - | button 11 | button 11 | button 11 |
CH21 | button 12 | - | button 12 | button 12 | button 12 |
CH22 | button 13 | - | button 13 | button 13 | button 13 |
CH23 | button 14 | - | button 14 | button 14 | button 14 |
CH24 | - | - | - | button 8POS (15-23) | button 8POS (15-23) |
Stick to the order the axis are declared. Applications are supposed to read axis IDs however many do not and use different kinds of position index instead.
Similar layouts:
other controller | use layout |
---|---|
OpenTX | EdgeTX pre 2.9 |
Orqa FPV.Ctrl | EdgeTX pre 2.9 |
Stadia | Android - use buttons 0-1, 3-4, 6-7, 10-14 and 16-19 |
Xbox | Android - use buttons 0-14 |
Items resolved during compability testing:
- dpad axis was displaced by about 0.5%
- the sim Steering axis is commonly supported on Linux and on some Android devices
- an additional circular cutout mode "X-Y, Z-rZ" was needed
Anybody else finding functional items gets a cookie :cookie:
Sorry for that - commit history is now squashed and without any merge commits.
Don't stress over it too much... that's why I said "where possible". As rebasing after having done merge commits can be messy and prone to things going wrong. So IMO not is worth the hassle if PR is otherwise self-contained and doesn't conflict.
On Sat, 6 Apr 2024, 6:37 am ThomasKuehne, @.***> wrote:
Sorry for that - commit history is now squashed and without any merge commits.
— Reply to this email directly, view it on GitHub https://github.com/EdgeTX/edgetx/pull/4626#issuecomment-2040594236, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJ66KIFIHNKOYIPG3GG57LY34DQBAVCNFSM6AAAAABDDWCKNCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBQGU4TIMRTGY . You are receiving this because your review was requested.Message ID: @.***>
No worries. The cause for the initial merge approach were the concurrent translation updates - especially Portuguese and Ukrainian - leading to merge conflicts.
Can we get some translations for this please 😃 Will be merged in seven days or when translations complete, whichever comes first.
-
TR_VUSBJOYSTICK_CH_SIM
has 4 additional values (last four) for the new axis -
TR_VUSBJOYSTICK_CIRC_COUTOUT
has 1 additional value (the last one) for the new circular cutout mode
#define TR_VUSBJOYSTICK_CH_SIM "Ail","Ele","Rud","Thr","Acc","Brk","Steer","Dpad"
#define TR_VUSBJOYSTICK_CIRC_COUTOUT "None","X-Y, Z-rX","X-Y, rX-rY","X-Y, Z-rZ"
- [x] @zyren CN / TW
- [x] @Eldenroot CZ
- [x] @HThuren DA
- [x] @ParkerEde / @TheIsotopes / @froqstar DE
- [x] @Pat6874 FR
- [x] @robustini IT
- [x] @ToshihiroMakuuchi JP
- [x] SE
- [ ] @ajjjjjjjj PL
- [x] @zandorsp PT
- [ ] @kobakirill RU
DE
#define TR_VUSBJOYSTICK_CH_SIM "Quer","Höhe","Seite","Gas","Beschl.","Bremsen","Lenkung","Dpad"
#define TR_VUSBJOYSTICK_CIRC_COUTOUT "kein","X-Y, Z-rX","X-Y, rX-rY","X-Y, Z-rZ"
How many chars do we have space for? I assumed 5 based on "Steer"
CN
#define TR_VUSBJOYSTICK_CH_SIM "横滚","俯仰","航向","油门","加速","刹车","转盘","方向"
#define TR_VUSBJOYSTICK_CIRC_COUTOUT "无","X-Y, Z-rX","X-Y, rX-rY","X-Y, Z-rZ"
TW
#define TR_VUSBJOYSTICK_CH_SIM "橫滾","俯仰","航向","油門","加速","剎車","轉盤","方向"
#define TR_VUSBJOYSTICK_CIRC_COUTOUT "無","X-Y, Z-rX","X-Y, rX-rY","X-Y, Z-rZ"
How many chars do we have space for? I assumed 5 based on "Steer"
I would try to keep it under 9 characters... this is the space it would fit in... (it's the Sim axis value)
FR:
#define TR_VUSBJOYSTICK_CH_SIM "Ail","Prof","Dir","Gaz","Acc","Frein","Gouv","Dpad" #define TR_VUSBJOYSTICK_CIRC_COUTOUT "Aucun","X-Y, Z-rX","X-Y, rX-rY","X-Y, Z-rZ"
Le mer. 29 mai 2024 à 14:53, Peter Feerick @.***> a écrit :
How many chars do we have space for? I assumed 5 based on "Steer"
I would try to keep it under 9 characters... this is the space it would fit in... (it's the Sim axis value) image.png (view on web) https://github.com/EdgeTX/edgetx/assets/5500713/c50be87b-057f-4403-b8f3-3c736900b914
— Reply to this email directly, view it on GitHub https://github.com/EdgeTX/edgetx/pull/4626#issuecomment-2137343753, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6HE7XKCEVXREEOVDEUUCITZEXFTZAVCNFSM6AAAAABDDWCKNCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZXGM2DGNZVGM . You are receiving this because you were mentioned.Message ID: @.***>
IT
#define TR_VUSBJOYSTICK_CH_SIM "Ale","Ele","Dir","Mot","Acc","Fre","Sterz","Dpad" #define TR_VUSBJOYSTICK_CIRC_COUTOUT "Nessuno","X-Y, Z-rX","X-Y, rX-rY","X-Y, Z-rZ"
DA (insert after line 160) #define TR_VUSBJOYSTICK_CH_SIM TR_STICK_NAMES3,TR_STICK_NAMES1,TR_STICK_NAMES0,TR_STICK_NAMES2,"Acc","Brems","Styr","Dpad" #define TR_VUSBJOYSTICK_CIRC_COUTOUT "Ingen","X-Y, Z-rX","X-Y, rX-rY","X-Y, Z-rZ"
CZ:
#define TR_VUSBJOYSTICK_CH_SIM "Ail","Ele","Rud","Thr","Acc","Brk","Steer","Dpad" #define TR_VUSBJOYSTICK_CIRC_COUTOUT "Žádný","X-Y, Z-rX","X-Y, rX-rY","X-Y, Z-rZ"
Quite difficult to translate some of them to Czech... because somebody uses translated ones. somebody uses English international names...
PT: #define TR_VUSBJOYSTICK_CH_SIM "Ail","Pfd","Lem","Mot","Acc","Brk","Steer","Dpad" #define TR_VUSBJOYSTICK_CIRC_COUTOUT "Nenh","X-Y, Z-rX","X-Y, rX-rY","X-Y, Z-rZ"
JP: #define TR_VUSBJOYSTICK_CH_SIM "Ail","Ele","Rud","Thr","Acc","Brk","Steer","Dpad" #define TR_VUSBJOYSTICK_CIRC_COUTOUT "なし","X-Y, Z-rX","X-Y, rX-rY","X-Y, Z-rZ"