Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
cf1dde16
Commit
cf1dde16
authored
Sep 04, 2015
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix button mask sent via manual control
parent
d7fe2ad3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
Joystick.cc
src/Joystick/Joystick.cc
+7
-10
No files found.
src/Joystick/Joystick.cc
View file @
cf1dde16
...
...
@@ -293,7 +293,7 @@ void Joystick::run(void)
// Adjust throttle to 0:1 range
if
(
_throttleMode
==
ThrottleModeCenterZero
)
{
throttle
=
std
::
max
(
0.0
f
,
throttle
);
throttle
=
std
::
max
(
0.0
f
,
throttle
);
}
else
{
throttle
=
(
throttle
+
1.0
f
)
/
2.0
f
;
}
...
...
@@ -312,15 +312,14 @@ void Joystick::run(void)
for
(
int
buttonIndex
=
0
;
buttonIndex
<
_buttonCount
;
buttonIndex
++
)
{
quint16
buttonBit
=
1
<<
buttonIndex
;
if
(
_rgButtonValues
[
buttonIndex
])
{
// Button
pressed down
, just record it
if
(
!
_rgButtonValues
[
buttonIndex
])
{
// Button
up
, just record it
newButtonBits
|=
buttonBit
;
}
else
{
if
(
_lastButtonBits
&
buttonBit
)
{
// Button was
down last time through, but is now up
which indicates a button press
// Button was
up last time through, but is now down
which indicates a button press
qCDebug
(
JoystickLog
)
<<
"button triggered"
<<
buttonIndex
;
if
(
buttonIndex
>=
reservedButtonCount
)
{
// Button is above firmware reserved set
int
buttonAction
=
_rgButtonActions
[
buttonIndex
];
...
...
@@ -328,13 +327,11 @@ void Joystick::run(void)
qCDebug
(
JoystickLog
)
<<
"buttonActionTriggered"
<<
buttonAction
;
emit
buttonActionTriggered
(
buttonAction
);
}
}
else
{
// Button is within firmware reserved set
// Record the button press for manualControl signal
buttonPressedBits
|=
buttonBit
;
qCDebug
(
JoystickLog
)
<<
"button press recorded for manualControl"
<<
buttonIndex
;
}
}
// Mark the button as pressed as long as its pressed
buttonPressedBits
|=
buttonBit
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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