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
a90073a1
Commit
a90073a1
authored
Oct 10, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #887 from DonLakeFlyer/RadioCal
Radio calibration fixes
parents
c929d0e8
00709a4e
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
172 additions
and
173 deletions
+172
-173
PX4RCCalibrationTest.cc
src/qgcunittest/PX4RCCalibrationTest.cc
+155
-165
PX4RCCalibrationTest.h
src/qgcunittest/PX4RCCalibrationTest.h
+5
-5
PX4RCCalibration.cc
src/ui/px4_configuration/PX4RCCalibration.cc
+12
-3
No files found.
src/qgcunittest/PX4RCCalibrationTest.cc
View file @
a90073a1
This diff is collapsed.
Click to expand it.
src/qgcunittest/PX4RCCalibrationTest.h
View file @
a90073a1
...
...
@@ -83,6 +83,7 @@ private:
};
struct
ChannelSettings
{
int
function
;
int
rcMin
;
int
rcMax
;
int
rcTrim
;
...
...
@@ -122,13 +123,12 @@ private:
static
const
int
_testTrimValue
;
static
const
int
_testThrottleTrimValue
;
static
const
int
_availableChannels
=
8
;
///< 8 channel RC Trasmitter
static
const
int
_requiredChannels
=
5
;
///< Required channels are 0-4
static
const
int
_minMaxChannels
=
_requiredChannels
+
1
;
///< Send min/max to channels 0-5
static
const
int
_attitudeChannels
=
4
;
///< Attitude channels are 0-3
static
const
int
_availableChannels
=
18
;
///< Simulate 18 channel RC Transmitter
static
const
struct
ChannelSettings
_rgChannelSettingsPreValidate
[
_availableChannels
];
static
const
struct
ChannelSettings
_rgChannelSettingsPostValidate
[
PX4RCCalibration
::
_chanMax
];
static
const
int
_rgFunctionChannelMap
[
PX4RCCalibration
::
rcCalFunctionMax
];
};
DECLARE_TEST
(
PX4RCCalibrationTest
)
...
...
src/ui/px4_configuration/PX4RCCalibration.cc
View file @
a90073a1
...
...
@@ -360,6 +360,7 @@ void PX4RCCalibration::_remoteControlChannelRawChanged(int chan, float fval)
// We always update raw values
_rcRawValue
[
chan
]
=
fval
;
//qDebug() << "Raw value" << chan << fval;
// Update state machine
switch
(
_rcCalState
)
{
...
...
@@ -392,7 +393,7 @@ void PX4RCCalibration::_remoteControlChannelRawChanged(int chan, float fval)
_updateView
();
// Confirm found channel
QString
msg
=
tr
(
"Found %1 [Channel %2]"
).
arg
(
_rgFunctionInfo
[
_rcCalStateCurrentChannel
].
functionName
).
arg
(
chan
);
QString
msg
=
tr
(
"Found %1 [Channel %2]"
).
arg
(
_rgFunctionInfo
[
_rcCalStateCurrentChannel
].
functionName
).
arg
(
chan
+
1
);
_ui
->
rcCalFound
->
setText
(
msg
);
//qDebug() << msg;
_ui
->
rcCalTryAgain
->
setEnabled
(
true
);
...
...
@@ -429,11 +430,12 @@ void PX4RCCalibration::_remoteControlChannelRawChanged(int chan, float fval)
Q_ASSERT
(
_rcCalStateCurrentChannel
>=
0
&&
_rcCalStateCurrentChannel
<
rcCalFunctionMax
);
if
(
chan
==
_rgFunctionChannelMapping
[
_rcCalStateCurrentChannel
])
{
// If the channel moved considerably use it to determine inversion
//qDebug() << "Detect inversion" << chan << _rcValueSave[chan] << fval << _rcCalMoveDelta;
if
(
fabsf
(
_rcValueSave
[
chan
]
-
fval
)
>
_rcCalMoveDelta
)
{
// Request was made to move channel to a lower value. If value goes up the channel is reversed.
bool
reversed
=
fval
>
_rcValueSave
[
chan
];
_rgChannelInfo
[
_rcCalStateCurrentChannel
].
reversed
=
reversed
;
_rgChannelInfo
[
chan
].
reversed
=
reversed
;
_updateView
();
// Confirm inversion detection
...
...
@@ -510,7 +512,13 @@ void PX4RCCalibration::_updateView()
if
(
info
->
function
==
rcCalFunctionMax
)
{
name
=
tr
(
"Channel %1"
).
arg
(
oneBasedChannel
);
}
else
{
name
=
tr
(
"%1 [Channel %2]"
).
arg
(
_rgFunctionInfo
[
info
->
function
].
functionName
).
arg
(
oneBasedChannel
);
QString
label
;
if
(
info
->
reversed
)
{
label
=
tr
(
"%1 [Channel %2,Rev]"
);
}
else
{
label
=
tr
(
"%1 [Channel %2]"
);
}
name
=
label
.
arg
(
_rgFunctionInfo
[
info
->
function
].
functionName
).
arg
(
oneBasedChannel
);
}
_rgRadioWidget
[
chan
]
->
setTitle
(
name
);
}
...
...
@@ -650,6 +658,7 @@ void PX4RCCalibration::_rcCalBegin(void)
/// @brief Saves the current channel values, so that we can detect when the use moves an input.
void
PX4RCCalibration
::
_rcCalSaveCurrentValues
(
void
)
{
//qDebug() << "_rcCalSaveCurrentValues";
for
(
unsigned
i
=
0
;
i
<
_chanMax
;
i
++
)
{
_rcValueSave
[
i
]
=
_rcRawValue
[
i
];
}
...
...
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