Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
b255b841
Commit
b255b841
authored
Dec 08, 2018
by
Matej Frančeškin
Committed by
Gus Grubba
Dec 10, 2018
Browse files
Bugfix: Android joystick had two axis mapped on the same button
parent
5ab7d32c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Joystick/JoystickAndroid.cc
View file @
b255b841
...
...
@@ -39,17 +39,23 @@ JoystickAndroid::JoystickAndroid(const QString& name, int axisCount, int buttonC
env
->
ReleaseBooleanArrayElements
(
jSupportedButtons
,
supportedButtons
,
0
);
//set axis mapping (number->code)
//
set axis mapping (number->code)
axisValue
=
new
int
[
_axisCount
];
axisCode
=
new
int
[
_axisCount
];
QAndroidJniObject
rangeListNative
=
inputDevice
.
callObjectMethod
(
"getMotionRanges"
,
"()Ljava/util/List;"
);
for
(
i
=
0
;
i
<
_axisCount
;
i
++
)
{
for
(
i
=
0
;
i
<
_axisCount
;
i
++
)
{
QAndroidJniObject
range
=
rangeListNative
.
callObjectMethod
(
"get"
,
"(I)Ljava/lang/Object;"
,
i
);
axisCode
[
i
]
=
range
.
callMethod
<
jint
>
(
"getAxis"
);
// Don't allow two axis with the same code
for
(
int
j
=
0
;
j
<
i
;
j
++
)
{
if
(
axisCode
[
i
]
==
axisCode
[
j
])
{
axisCode
[
i
]
=
-
1
;
break
;
}
}
axisValue
[
i
]
=
0
;
}
qCDebug
(
JoystickLog
)
<<
"axis:"
<<
_axisCount
<<
"buttons:"
<<
_buttonCount
;
QtAndroidPrivate
::
registerGenericMotionEventListener
(
this
);
QtAndroidPrivate
::
registerKeyEventListener
(
this
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment