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
0813a407
Commit
0813a407
authored
Jul 09, 2019
by
Tomaz Canabrava
Committed by
Daniel Agar
Jul 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More lists to bracet initialization
parent
d22a9bb1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
18 deletions
+11
-18
PX4AdvancedFlightModesController.cc
src/AutoPilotPlugins/PX4/PX4AdvancedFlightModesController.cc
+11
-18
No files found.
src/AutoPilotPlugins/PX4/PX4AdvancedFlightModesController.cc
View file @
0813a407
...
...
@@ -138,13 +138,11 @@ void PX4AdvancedFlightModesController::_validateConfiguration(void)
_validConfiguration
=
true
;
// Make sure switches are valid and within channel range
QStringList
switchParams
;
const
QStringList
switchParams
=
{
"RC_MAP_MODE_SW"
,
"RC_MAP_ACRO_SW"
,
"RC_MAP_POSCTL_SW"
,
"RC_MAP_LOITER_SW"
,
"RC_MAP_RETURN_SW"
,
"RC_MAP_OFFB_SW"
}
;
QList
<
int
>
switchMappings
;
switchParams
<<
"RC_MAP_MODE_SW"
<<
"RC_MAP_ACRO_SW"
<<
"RC_MAP_POSCTL_SW"
<<
"RC_MAP_LOITER_SW"
<<
"RC_MAP_RETURN_SW"
<<
"RC_MAP_OFFB_SW"
;
for
(
int
i
=
0
;
i
<
switchParams
.
count
();
i
++
)
{
for
(
int
i
=
0
,
end
=
switchParams
.
count
();
i
<
end
;
i
++
)
{
int
map
=
getParameterFact
(
FactSystem
::
defaultComponentId
,
switchParams
[
i
])
->
rawValue
().
toInt
();
switchMappings
<<
map
;
...
...
@@ -155,16 +153,16 @@ void PX4AdvancedFlightModesController::_validateConfiguration(void)
}
// Make sure mode switches are not double-mapped
QStringList
attitudeParams
;
attitudeParams
<<
"RC_MAP_THROTTLE"
<<
"RC_MAP_YAW"
<<
"RC_MAP_PITCH"
<<
"RC_MAP_ROLL"
<<
"RC_MAP_FLAPS"
<<
"RC_MAP_AUX1"
<<
"RC_MAP_AUX2"
;
for
(
int
i
=
0
;
i
<
attitudeParams
.
count
();
i
++
)
{
const
QStringList
attitudeParams
=
{
"RC_MAP_THROTTLE"
,
"RC_MAP_YAW"
,
"RC_MAP_PITCH"
,
"RC_MAP_ROLL"
,
"RC_MAP_FLAPS"
,
"RC_MAP_AUX1"
,
"RC_MAP_AUX2"
};
for
(
int
i
=
0
,
end
=
attitudeParams
.
count
();
i
<
end
;
i
++
)
{
int
map
=
getParameterFact
(
FactSystem
::
defaultComponentId
,
attitudeParams
[
i
])
->
rawValue
().
toInt
();
if
(
map
==
0
)
{
continue
;
}
for
(
int
j
=
0
;
j
<
switchParams
.
count
();
j
++
)
{
if
(
map
!=
0
&&
map
==
switchMappings
[
j
])
{
if
(
map
==
switchMappings
[
j
])
{
_validConfiguration
=
false
;
_configurationErrors
+=
tr
(
"%1 is set to same channel as %2.
\n
"
).
arg
(
switchParams
[
j
],
attitudeParams
[
i
]);
}
...
...
@@ -172,12 +170,7 @@ void PX4AdvancedFlightModesController::_validateConfiguration(void)
}
// Validate thresholds within range
QStringList
thresholdParams
;
thresholdParams
<<
"RC_ASSIST_TH"
<<
"RC_AUTO_TH"
<<
"RC_ACRO_TH"
<<
"RC_POSCTL_TH"
<<
"RC_LOITER_TH"
<<
"RC_RETURN_TH"
<<
"RC_OFFB_TH"
;
foreach
(
const
QString
&
thresholdParam
,
thresholdParams
)
{
for
(
const
QString
&
thresholdParam
:
{
"RC_ASSIST_TH"
,
"RC_AUTO_TH"
,
"RC_ACRO_TH"
,
"RC_POSCTL_TH"
,
"RC_LOITER_TH"
,
"RC_RETURN_TH"
,
"RC_OFFB_TH"
})
{
float
threshold
=
getParameterFact
(
-
1
,
thresholdParam
)
->
rawValue
().
toFloat
();
if
(
threshold
<
0.0
f
||
threshold
>
1.0
f
)
{
_validConfiguration
=
false
;
...
...
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