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
7fcae94c
Commit
7fcae94c
authored
Oct 20, 2016
by
Gregory Dymarek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't apply throttle deadband in ThrottleModeDownZero
parent
c8d39176
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
24 deletions
+26
-24
Joystick.cc
src/Joystick/Joystick.cc
+11
-8
Joystick.h
src/Joystick/Joystick.h
+1
-1
JoystickConfig.qml
src/VehicleSetup/JoystickConfig.qml
+14
-15
No files found.
src/Joystick/Joystick.cc
View file @
7fcae94c
...
...
@@ -199,14 +199,12 @@ void Joystick::_saveSettings(void)
}
/// Adjust the raw axis value to the -1:1 range given calibration information
float
Joystick
::
_adjustRange
(
int
value
,
Calibration_t
calibration
)
float
Joystick
::
_adjustRange
(
int
value
,
Calibration_t
calibration
,
bool
withDeadbands
)
{
float
valueNormalized
;
float
axisLength
;
float
axisBasis
;
if
(
value
>
calibration
.
center
)
{
axisBasis
=
1.0
f
;
valueNormalized
=
value
-
calibration
.
center
;
...
...
@@ -217,7 +215,7 @@ float Joystick::_adjustRange(int value, Calibration_t calibration)
axisLength
=
calibration
.
center
-
calibration
.
min
;
}
if
(
_deadband
)
{
if
(
withDeadbands
)
{
if
(
valueNormalized
>
calibration
.
deadband
)
valueNormalized
-=
calibration
.
deadband
;
else
if
(
valueNormalized
<-
calibration
.
deadband
)
valueNormalized
+=
calibration
.
deadband
;
else
valueNormalized
=
0.
f
;
...
...
@@ -290,16 +288,16 @@ void Joystick::run(void)
if
(
_calibrationMode
!=
CalibrationModeCalibrating
)
{
int
axis
=
_rgFunctionAxis
[
rollFunction
];
float
roll
=
_adjustRange
(
_rgAxisValues
[
axis
],
_rgCalibration
[
axis
]);
float
roll
=
_adjustRange
(
_rgAxisValues
[
axis
],
_rgCalibration
[
axis
]
,
_deadband
);
axis
=
_rgFunctionAxis
[
pitchFunction
];
float
pitch
=
_adjustRange
(
_rgAxisValues
[
axis
],
_rgCalibration
[
axis
]);
float
pitch
=
_adjustRange
(
_rgAxisValues
[
axis
],
_rgCalibration
[
axis
]
,
_deadband
);
axis
=
_rgFunctionAxis
[
yawFunction
];
float
yaw
=
_adjustRange
(
_rgAxisValues
[
axis
],
_rgCalibration
[
axis
]);
float
yaw
=
_adjustRange
(
_rgAxisValues
[
axis
],
_rgCalibration
[
axis
]
,
_deadband
);
axis
=
_rgFunctionAxis
[
throttleFunction
];
float
throttle
=
_adjustRange
(
_rgAxisValues
[
axis
],
_rgCalibration
[
axis
]);
float
throttle
=
_adjustRange
(
_rgAxisValues
[
axis
],
_rgCalibration
[
axis
]
,
_throttleMode
==
ThrottleModeDownZero
?
false
:
_deadband
);
if
(
_accumulator
)
{
static
float
throttle_accu
=
0.
f
;
...
...
@@ -546,6 +544,11 @@ void Joystick::setThrottleMode(int mode)
}
_throttleMode
=
(
ThrottleMode_t
)
mode
;
if
(
_throttleMode
==
ThrottleModeDownZero
)
{
setAccumulator
(
false
);
}
_saveSettings
();
emit
throttleModeChanged
(
_throttleMode
);
}
...
...
src/Joystick/Joystick.h
View file @
7fcae94c
...
...
@@ -143,7 +143,7 @@ signals:
protected:
void
_saveSettings
(
void
);
void
_loadSettings
(
void
);
float
_adjustRange
(
int
value
,
Calibration_t
calibration
);
float
_adjustRange
(
int
value
,
Calibration_t
calibration
,
bool
withDeadbands
);
void
_buttonAction
(
const
QString
&
action
);
bool
_validAxis
(
int
axis
);
bool
_validButton
(
int
button
);
...
...
src/VehicleSetup/JoystickConfig.qml
View file @
7fcae94c
...
...
@@ -422,21 +422,6 @@ SetupPage {
}
}
Row
{
x
:
20
width
:
parent
.
width
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
_activeJoystick
.
throttleMode
==
0
QGCCheckBox
{
id
:
deadband
checked
:
controller
.
deadbandToggle
text
:
qsTr
(
"
Deadbands
"
)
onClicked
:
controller
.
deadbandToggle
=
checked
}
}
QGCRadioButton
{
exclusiveGroup
:
throttleModeExclusiveGroup
text
:
qsTr
(
"
Full down stick is zero throttle
"
)
...
...
@@ -490,6 +475,20 @@ SetupPage {
onActivated
:
_activeVehicle
.
joystickMode
=
index
}
}
Row
{
width
:
parent
.
width
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
advancedSettings
.
checked
QGCCheckBox
{
id
:
deadband
checked
:
controller
.
deadbandToggle
text
:
qsTr
(
"
Deadbands
"
)
onClicked
:
controller
.
deadbandToggle
=
checked
}
}
}
}
// Column - left column
...
...
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