Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
07052d03
Commit
07052d03
authored
Apr 18, 2016
by
Lorenz Meier
Browse files
Merge pull request #3244 from mavlink/fltmode_fixes
Fix flight mode display for PX4. Missed reverse channel check
parents
6ab27c17
e8970606
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml
View file @
07052d03
...
@@ -114,7 +114,7 @@ Item {
...
@@ -114,7 +114,7 @@ Item {
QGCLabel
{
QGCLabel
{
anchors.baseline
:
modeCombo
.
baseline
anchors.baseline
:
modeCombo
.
baseline
text
:
qsTr
(
"
Flight Mode %1
:)
"
).
arg
(
index
)
text
:
qsTr
(
"
Flight Mode %1
"
).
arg
(
index
)
color
:
controller
.
activeFlightMode
==
index
?
"
yellow
"
:
qgcPal
.
text
color
:
controller
.
activeFlightMode
==
index
?
"
yellow
"
:
qgcPal
.
text
}
}
...
...
src/AutoPilotPlugins/PX4/PX4SimpleFlightModesController.cc
View file @
07052d03
...
@@ -55,6 +55,8 @@ void PX4SimpleFlightModesController::_rcChannelsChanged(int channelCount, int pw
...
@@ -55,6 +55,8 @@ void PX4SimpleFlightModesController::_rcChannelsChanged(int channelCount, int pw
int
flightModeChannel
=
getParameterFact
(
-
1
,
"RC_MAP_FLTMODE"
)
->
rawValue
().
toInt
()
-
1
;
int
flightModeChannel
=
getParameterFact
(
-
1
,
"RC_MAP_FLTMODE"
)
->
rawValue
().
toInt
()
-
1
;
int
flightModeReversed
=
getParameterFact
(
1
,
QString
(
"RC%1_REV"
).
arg
(
flightModeChannel
+
1
))
->
rawValue
().
toInt
();
if
(
flightModeChannel
<
0
||
flightModeChannel
>
channelCount
)
{
if
(
flightModeChannel
<
0
||
flightModeChannel
>
channelCount
)
{
return
;
return
;
}
}
...
@@ -63,7 +65,7 @@ void PX4SimpleFlightModesController::_rcChannelsChanged(int channelCount, int pw
...
@@ -63,7 +65,7 @@ void PX4SimpleFlightModesController::_rcChannelsChanged(int channelCount, int pw
int
channelValue
=
pwmValues
[
flightModeChannel
];
int
channelValue
=
pwmValues
[
flightModeChannel
];
if
(
channelValue
!=
-
1
)
{
if
(
channelValue
!=
-
1
)
{
bool
found
=
false
;
bool
found
=
false
;
int
rgThreshold
[]
=
{
12
3
0
,
1360
,
1490
,
1620
,
1
749
};
int
rgThreshold
[]
=
{
12
0
0
,
1360
,
1490
,
1620
,
1
900
};
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
if
(
channelValue
<=
rgThreshold
[
i
])
{
if
(
channelValue
<=
rgThreshold
[
i
])
{
_activeFlightMode
=
i
+
1
;
_activeFlightMode
=
i
+
1
;
...
@@ -71,9 +73,15 @@ void PX4SimpleFlightModesController::_rcChannelsChanged(int channelCount, int pw
...
@@ -71,9 +73,15 @@ void PX4SimpleFlightModesController::_rcChannelsChanged(int channelCount, int pw
break
;
break
;
}
}
}
}
if
(
!
found
)
{
if
(
!
found
)
{
_activeFlightMode
=
6
;
_activeFlightMode
=
6
;
}
}
if
(
flightModeReversed
==
-
1
)
{
_activeFlightMode
=
6
-
(
_activeFlightMode
-
1
);
}
}
}
emit
activeFlightModeChanged
(
_activeFlightMode
);
emit
activeFlightModeChanged
(
_activeFlightMode
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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