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
f5b8a934
Commit
f5b8a934
authored
Dec 23, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure trims are within min/max
parent
2607ff74
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
14 deletions
+20
-14
PX4RCCalibrationTest.cc
src/qgcunittest/PX4RCCalibrationTest.cc
+14
-13
PX4RCCalibration.cc
src/ui/px4_configuration/PX4RCCalibration.cc
+6
-1
No files found.
src/qgcunittest/PX4RCCalibrationTest.cc
View file @
f5b8a934
...
...
@@ -109,17 +109,17 @@ const struct PX4RCCalibrationTest::ChannelSettings PX4RCCalibrationTest::_rgChan
{
PX4RCCalibration
::
rcCalFunctionMax
,
PX4RCCalibration
::
_rcCalPWMDefaultMinValue
,
PX4RCCalibration
::
_rcCalPWMDefaultMaxValue
,
PX4RCCalibration
::
_rcCalPWMCenterPoint
,
false
},
// Channels 1-11 are mapped to all available modes
{
PX4RCCalibration
::
rcCalFunctionRoll
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
true
},
{
PX4RCCalibration
::
rcCalFunctionPitch
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionYaw
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
true
},
{
PX4RCCalibration
::
rcCalFunctionThrottle
,
_testMinValue
,
_testMaxValue
,
_testMinValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionModeSwitch
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionPosCtlSwitch
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionLoiterSwitch
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionReturnSwitch
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionFlaps
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionAux1
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionAux2
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionRoll
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
true
},
{
PX4RCCalibration
::
rcCalFunctionPitch
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionYaw
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
true
},
{
PX4RCCalibration
::
rcCalFunctionThrottle
,
_testMinValue
,
_testMaxValue
,
_testMinValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionModeSwitch
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionPosCtlSwitch
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionLoiterSwitch
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionReturnSwitch
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionFlaps
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionAux1
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
{
PX4RCCalibration
::
rcCalFunctionAux2
,
_testMinValue
,
_testMaxValue
,
_testCenterValue
,
false
},
// Channels 12-17 are not mapped and should be set to defaults
{
PX4RCCalibration
::
rcCalFunctionMax
,
PX4RCCalibration
::
_rcCalPWMDefaultMinValue
,
PX4RCCalibration
::
_rcCalPWMDefaultMaxValue
,
PX4RCCalibration
::
_rcCalPWMCenterPoint
,
false
},
...
...
@@ -435,8 +435,9 @@ void PX4RCCalibrationTest::_channelHomePosition(void)
_mockUAS
->
emitRemoteControlChannelRawChanged
(
i
,
(
float
)
PX4RCCalibration
::
_rcCalPWMCenterPoint
);
}
// Throttle to low position (throttle is not reversed)/
_mockUAS
->
emitRemoteControlChannelRawChanged
(
_rgFunctionChannelMap
[
PX4RCCalibration
::
rcCalFunctionThrottle
],
_testMinValue
);
// Throttle to min - 1 (throttle is not reversed). We do this so that the trim value is below the min value. This should end up
// being validated and raised to min value. If not, something is wrong with RC Cal code.
_mockUAS
->
emitRemoteControlChannelRawChanged
(
_rgFunctionChannelMap
[
PX4RCCalibration
::
rcCalFunctionThrottle
],
_testMinValue
-
1
);
}
void
PX4RCCalibrationTest
::
_validateParameters
(
void
)
...
...
src/ui/px4_configuration/PX4RCCalibration.cc
View file @
f5b8a934
...
...
@@ -837,6 +837,12 @@ void PX4RCCalibration::_validateCalibration(void)
case
rcCalFunctionYaw
:
case
rcCalFunctionRoll
:
case
rcCalFunctionPitch
:
// Make sure trim is within min/max
if
(
info
->
rcTrim
<
info
->
rcMin
)
{
info
->
rcTrim
=
info
->
rcMin
;
}
else
if
(
info
->
rcTrim
>
info
->
rcMax
)
{
info
->
rcTrim
=
info
->
rcMax
;
}
break
;
default:
// Non-attitude control channels have calculated trim
...
...
@@ -858,7 +864,6 @@ void PX4RCCalibration::_validateCalibration(void)
/// @brief Saves the rc calibration values to the board parameters.
/// @param trimsOnly true: write only trim values, false: write all calibration values
void
PX4RCCalibration
::
_writeCalibration
(
void
)
{
if
(
!
_mav
)
return
;
...
...
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