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
9868e0d5
Commit
9868e0d5
authored
Mar 07, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix settable flight mode channel
parent
76975530
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
11 deletions
+31
-11
APMFlightModesComponent.qml
src/AutoPilotPlugins/APM/APMFlightModesComponent.qml
+23
-2
APMFlightModesComponentController.cc
...AutoPilotPlugins/APM/APMFlightModesComponentController.cc
+8
-8
APMFlightModesComponentController.h
src/AutoPilotPlugins/APM/APMFlightModesComponentController.h
+0
-1
No files found.
src/AutoPilotPlugins/APM/APMFlightModesComponent.qml
View file @
9868e0d5
...
...
@@ -39,6 +39,9 @@ QGCView {
property
bool
_channel7OptionsAvailable
:
controller
.
parameterExists
(
-
1
,
"
CH7_OPT
"
)
// Not available in all firmware types
property
bool
_channel9OptionsAvailable
:
controller
.
parameterExists
(
-
1
,
"
CH9_OPT
"
)
// Not available in all firmware types
property
int
_channelOptionCount
:
_channel7OptionsAvailable
?
(
_channel9OptionsAvailable
?
6
:
2
)
:
0
property
Fact
_nullFact
property
bool
_fltmodeChExists
:
controller
.
parameterExists
(
-
1
,
"
FLTMODE_CH
"
)
property
Fact
_fltmodeCh
:
_fltmodeChExists
?
controller
.
getParameterFact
(
-
1
,
"
FLTMODE_CH
"
)
:
_nullFact
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
panel
.
enabled
}
...
...
@@ -59,7 +62,7 @@ QGCView {
QGCLabel
{
id
:
flightModeLabel
text
:
"
Channel 5 Flight Mode Settings
"
text
:
"
Flight Mode Settings
"
+
(
_fltmodeChExists
?
""
:
"
(Channel 5)
"
)
font.weight
:
Font
.
DemiBold
}
...
...
@@ -75,10 +78,28 @@ QGCView {
id
:
flightModeColumn
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
anchors.left
:
parent
.
left
// anchors.right: parent.right
anchors.top
:
parent
.
top
spacing
:
ScreenTools
.
defaultFontPixelHeight
Row
{
spacing
:
_margins
visible
:
_fltmodeChExists
QGCLabel
{
id
:
modeChannelLabel
anchors.baseline
:
modeChannelCombo
.
baseline
text
:
"
Flight mode channel:
"
}
QGCComboBox
{
id
:
modeChannelCombo
width
:
ScreenTools
.
defaultFontPixelWidth
*
15
model
:
[
"
Not assigned
"
,
"
Channel 1
"
,
"
Channel 2
"
,
"
Channel 3
"
,
"
Channel 4
"
,
"
Channel 5
"
,
"
Channel 6
"
,
"
Channel 7
"
,
"
Channel 8
"
]
currentIndex
:
_fltmodeCh
.
value
onActivated
:
_fltmodeCh
.
value
=
index
}
}
Repeater
{
model
:
6
...
...
src/AutoPilotPlugins/APM/APMFlightModesComponentController.cc
View file @
9868e0d5
...
...
@@ -32,8 +32,6 @@ APMFlightModesComponentController::APMFlightModesComponentController(void)
:
_activeFlightMode
(
0
)
,
_channelCount
(
Vehicle
::
cMaxRcChannels
)
,
_fixedWing
(
_vehicle
->
vehicleType
()
==
MAV_TYPE_FIXED_WING
)
,
_flightModeChannel
(
5
)
{
QStringList
usedParams
;
usedParams
<<
QStringLiteral
(
"FLTMODE1"
)
<<
QStringLiteral
(
"FLTMODE2"
)
<<
QStringLiteral
(
"FLTMODE3"
)
...
...
@@ -42,10 +40,6 @@ APMFlightModesComponentController::APMFlightModesComponentController(void)
return
;
}
if
(
parameterExists
(
FactSystem
::
defaultComponentId
,
QStringLiteral
(
"FLTMODE_CH"
)))
{
_flightModeChannel
=
getParameterFact
(
FactSystem
::
defaultComponentId
,
QStringLiteral
(
"FLTMODE_CH"
))
->
rawValue
().
toInt
();
}
_rgChannelOptionEnabled
<<
QVariant
(
false
)
<<
QVariant
(
false
)
<<
QVariant
(
false
)
<<
QVariant
(
false
)
<<
QVariant
(
false
)
<<
QVariant
(
false
);
connect
(
_vehicle
,
&
Vehicle
::
rcChannelsChanged
,
this
,
&
APMFlightModesComponentController
::
_rcChannelsChanged
);
...
...
@@ -54,12 +48,18 @@ APMFlightModesComponentController::APMFlightModesComponentController(void)
/// Connected to Vehicle::rcChannelsChanged signal
void
APMFlightModesComponentController
::
_rcChannelsChanged
(
int
channelCount
,
int
pwmValues
[
Vehicle
::
cMaxRcChannels
])
{
if
(
_flightModeChannel
>
channelCount
)
{
int
flightModeChannel
=
4
;
if
(
parameterExists
(
FactSystem
::
defaultComponentId
,
QStringLiteral
(
"FLTMODE_CH"
)))
{
flightModeChannel
=
getParameterFact
(
FactSystem
::
defaultComponentId
,
QStringLiteral
(
"FLTMODE_CH"
))
->
rawValue
().
toInt
()
-
1
;
}
if
(
flightModeChannel
>=
channelCount
)
{
return
;
}
_activeFlightMode
=
0
;
int
channelValue
=
pwmValues
[
_flightModeChannel
-
1
];
int
channelValue
=
pwmValues
[
flightModeChannel
];
if
(
channelValue
!=
-
1
)
{
bool
found
=
false
;
int
rgThreshold
[]
=
{
1230
,
1360
,
1490
,
1620
,
1749
};
...
...
src/AutoPilotPlugins/APM/APMFlightModesComponentController.h
View file @
9868e0d5
...
...
@@ -62,7 +62,6 @@ private:
int
_channelCount
;
QVariantList
_rgChannelOptionEnabled
;
bool
_fixedWing
;
int
_flightModeChannel
;
};
#endif
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