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
f90d1b98
Commit
f90d1b98
authored
May 04, 2019
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
4224b476
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
51 deletions
+29
-51
APMFlightModesComponent.qml
src/AutoPilotPlugins/APM/APMFlightModesComponent.qml
+2
-2
APMFlightModesComponentController.cc
...AutoPilotPlugins/APM/APMFlightModesComponentController.cc
+26
-47
APMFlightModesComponentController.h
src/AutoPilotPlugins/APM/APMFlightModesComponentController.h
+1
-2
No files found.
src/AutoPilotPlugins/APM/APMFlightModesComponent.qml
View file @
f90d1b98
...
@@ -150,7 +150,7 @@ SetupPage {
...
@@ -150,7 +150,7 @@ SetupPage {
Layout.alignment
:
Qt
.
AlignHCenter
Layout.alignment
:
Qt
.
AlignHCenter
visible
:
_customSimpleMode
visible
:
_customSimpleMode
checked
:
modelData
checked
:
modelData
onClicked
:
controller
.
setSimpleMode
(
index
,
checked
)
onClicked
:
controller
.
setS
uperS
impleMode
(
index
,
checked
)
}
}
}
}
...
@@ -166,7 +166,7 @@ SetupPage {
...
@@ -166,7 +166,7 @@ SetupPage {
spacing
:
_margins
spacing
:
_margins
visible
:
controller
.
simpleModesSupported
visible
:
controller
.
simpleModesSupported
QGCLabel
{
text
:
qsTr
(
"
S
et All Flight Modes To
"
)
}
QGCLabel
{
text
:
qsTr
(
"
S
imple Mode
"
)
}
QGCComboBox
{
QGCComboBox
{
model
:
controller
.
simpleModeNames
model
:
controller
.
simpleModeNames
...
...
src/AutoPilotPlugins/APM/APMFlightModesComponentController.cc
View file @
f90d1b98
...
@@ -39,13 +39,7 @@ APMFlightModesComponentController::APMFlightModesComponentController(void)
...
@@ -39,13 +39,7 @@ APMFlightModesComponentController::APMFlightModesComponentController(void)
}
}
if
(
!
_rover
)
{
if
(
!
_rover
)
{
for
(
int
i
=
0
;
i
<
_cFltModes
;
i
++
)
{
_setupSimpleModeEnabled
();
Fact
*
fltModeFact
=
getParameterFact
(
-
1
,
QStringLiteral
(
"%1%2"
).
arg
(
_modeParamPrefix
).
arg
(
i
+
1
));
_rgFltModeFacts
.
append
(
fltModeFact
);
connect
(
fltModeFact
,
&
Fact
::
rawValueChanged
,
this
,
&
APMFlightModesComponentController
::
_adjustSimpleModeEnabledFromParams
);
}
_adjustSimpleModeEnabledFromParams
();
uint8_t
simpleModeValue
=
static_cast
<
uint8_t
>
(
_simpleModeFact
->
rawValue
().
toUInt
());
uint8_t
simpleModeValue
=
static_cast
<
uint8_t
>
(
_simpleModeFact
->
rawValue
().
toUInt
());
uint8_t
superSimpleModeValue
=
static_cast
<
uint8_t
>
(
_superSimpleModeFact
->
rawValue
().
toUInt
());
uint8_t
superSimpleModeValue
=
static_cast
<
uint8_t
>
(
_superSimpleModeFact
->
rawValue
().
toUInt
());
...
@@ -59,9 +53,7 @@ APMFlightModesComponentController::APMFlightModesComponentController(void)
...
@@ -59,9 +53,7 @@ APMFlightModesComponentController::APMFlightModesComponentController(void)
_simpleMode
=
SimpleModeCustom
;
_simpleMode
=
SimpleModeCustom
;
}
}
connect
(
this
,
&
APMFlightModesComponentController
::
simpleModeChanged
,
this
,
&
APMFlightModesComponentController
::
_updateSimpleParamsFromSimpleMode
);
connect
(
this
,
&
APMFlightModesComponentController
::
simpleModeChanged
,
this
,
&
APMFlightModesComponentController
::
_updateSimpleParamsFromSimpleMode
);
connect
(
_simpleModeFact
,
&
Fact
::
rawValueChanged
,
this
,
&
APMFlightModesComponentController
::
_adjustSimpleModeEnabledFromParams
);
connect
(
_superSimpleModeFact
,
&
Fact
::
rawValueChanged
,
this
,
&
APMFlightModesComponentController
::
_adjustSimpleModeEnabledFromParams
);
}
}
QStringList
usedParams
;
QStringList
usedParams
;
...
@@ -131,6 +123,13 @@ void APMFlightModesComponentController::_updateSimpleParamsFromSimpleMode(void)
...
@@ -131,6 +123,13 @@ void APMFlightModesComponentController::_updateSimpleParamsFromSimpleMode(void)
newSuperSimpleModeValue
=
_allSimpleBits
;
newSuperSimpleModeValue
=
_allSimpleBits
;
}
}
for
(
int
i
=
0
;
i
<
_cFltModes
;
i
++
)
{
_simpleModeEnabled
[
i
]
=
false
;
_superSimpleModeEnabled
[
i
]
=
false
;
}
emit
simpleModeEnabledChanged
();
emit
superSimpleModeEnabledChanged
();
_simpleModeFact
->
setRawValue
(
newSimpleModeValue
);
_simpleModeFact
->
setRawValue
(
newSimpleModeValue
);
_superSimpleModeFact
->
setRawValue
(
newSuperSimpleModeValue
);
_superSimpleModeFact
->
setRawValue
(
newSuperSimpleModeValue
);
}
}
...
@@ -138,58 +137,38 @@ void APMFlightModesComponentController::_updateSimpleParamsFromSimpleMode(void)
...
@@ -138,58 +137,38 @@ void APMFlightModesComponentController::_updateSimpleParamsFromSimpleMode(void)
void
APMFlightModesComponentController
::
setSimpleMode
(
int
fltModeIndex
,
bool
enabled
)
void
APMFlightModesComponentController
::
setSimpleMode
(
int
fltModeIndex
,
bool
enabled
)
{
{
if
(
fltModeIndex
<
_cFltModes
)
{
if
(
fltModeIndex
<
_cFltModes
)
{
int
fltMode
=
_rgFltModeFacts
[
fltModeIndex
]
->
rawValue
().
toInt
();
uint8_t
mode
=
static_cast
<
uint8_t
>
(
_simpleModeFact
->
rawValue
().
toInt
());
if
(
fltMode
<
_cSimpleModeBits
)
{
if
(
enabled
)
{
uint8_t
mode
=
static_cast
<
uint8_t
>
(
_simpleModeFact
->
rawValue
().
toInt
());
mode
|=
1
<<
fltModeIndex
;
if
(
enabled
)
{
}
else
{
mode
|=
1
<<
fltMode
;
mode
&=
~
(
1
<<
fltModeIndex
);
}
else
{
mode
&=
~
(
1
<<
fltMode
);
}
_simpleModeFact
->
setRawValue
(
mode
);
}
}
_simpleModeFact
->
setRawValue
(
mode
);
}
}
}
}
void
APMFlightModesComponentController
::
setSuperSimpleMode
(
int
fltModeIndex
,
bool
enabled
)
void
APMFlightModesComponentController
::
setSuperSimpleMode
(
int
fltModeIndex
,
bool
enabled
)
{
{
if
(
fltModeIndex
<
_cFltModes
)
{
if
(
fltModeIndex
<
_cFltModes
)
{
int
fltMode
=
_rgFltModeFacts
[
fltModeIndex
]
->
rawValue
().
toInt
();
uint8_t
mode
=
static_cast
<
uint8_t
>
(
_superSimpleModeFact
->
rawValue
().
toInt
());
if
(
fltMode
<
_cSimpleModeBits
)
{
if
(
enabled
)
{
uint8_t
mode
=
static_cast
<
uint8_t
>
(
_superSimpleModeFact
->
rawValue
().
toInt
());
mode
|=
1
<<
fltModeIndex
;
if
(
enabled
)
{
}
else
{
mode
|=
1
<<
fltMode
;
mode
&=
~
(
1
<<
fltModeIndex
);
}
else
{
mode
&=
~
(
1
<<
fltMode
);
}
_superSimpleModeFact
->
setRawValue
(
mode
);
}
}
_superSimpleModeFact
->
setRawValue
(
mode
);
}
}
}
}
void
APMFlightModesComponentController
::
_
adjustSimpleModeEnabledFromParams
(
void
)
void
APMFlightModesComponentController
::
_
setupSimpleModeEnabled
(
void
)
{
{
uint8_t
simpleMode
=
static_cast
<
uint8_t
>
(
_simpleModeFact
->
rawValue
().
toUInt
());
uint8_t
simpleMode
=
static_cast
<
uint8_t
>
(
_simpleModeFact
->
rawValue
().
toUInt
());
uint8_t
superSimpleMode
=
static_cast
<
uint8_t
>
(
_superSimpleModeFact
->
rawValue
().
toUInt
());
uint8_t
superSimpleMode
=
static_cast
<
uint8_t
>
(
_superSimpleModeFact
->
rawValue
().
toUInt
());
for
(
int
fltModeIndex
=
0
;
fltModeIndex
<
_cFltModes
;
fltModeIndex
++
)
{
for
(
int
i
=
0
;
i
<
_cFltModes
;
i
++
)
{
_simpleModeEnabled
[
fltModeIndex
]
=
false
;
uint8_t
bitSet
=
static_cast
<
uint8_t
>
(
1
<<
i
);
_superSimpleModeEnabled
[
fltModeIndex
]
=
false
;
_simpleModeEnabled
[
i
]
=
!!
(
simpleMode
&
bitSet
);
}
_superSimpleModeEnabled
[
i
]
=
!!
(
superSimpleMode
&
bitSet
);
for
(
int
fltModeBit
=
0
;
fltModeBit
<
_cSimpleModeBits
;
fltModeBit
++
)
{
for
(
int
fltModeIndex
=
0
;
fltModeIndex
<
_cFltModes
;
fltModeIndex
++
)
{
int
fltModeValue
=
_rgFltModeFacts
[
fltModeIndex
]
->
rawValue
().
toInt
();
uint8_t
bitSet
=
1
<<
fltModeBit
;
bool
simpleModeBitEnabled
=
!!
(
simpleMode
&
bitSet
)
&&
fltModeValue
==
fltModeBit
;
bool
superSimpleModeBitEnabled
=
!!
(
superSimpleMode
&
bitSet
)
&&
fltModeValue
==
fltModeBit
;
if
(
simpleModeBitEnabled
)
{
_simpleModeEnabled
[
fltModeIndex
]
=
true
;
}
if
(
superSimpleModeBitEnabled
)
{
_superSimpleModeEnabled
[
fltModeIndex
]
=
true
;
}
}
}
}
emit
simpleModeEnabledChanged
();
emit
simpleModeEnabledChanged
();
...
...
src/AutoPilotPlugins/APM/APMFlightModesComponentController.h
View file @
f90d1b98
...
@@ -64,7 +64,7 @@ signals:
...
@@ -64,7 +64,7 @@ signals:
private
slots
:
private
slots
:
void
_rcChannelsChanged
(
int
channelCount
,
int
pwmValues
[
Vehicle
::
cMaxRcChannels
]);
void
_rcChannelsChanged
(
int
channelCount
,
int
pwmValues
[
Vehicle
::
cMaxRcChannels
]);
void
_updateSimpleParamsFromSimpleMode
(
void
);
void
_updateSimpleParamsFromSimpleMode
(
void
);
void
_
adjustSimpleModeEnabledFromParams
(
void
);
void
_
setupSimpleModeEnabled
(
void
);
private:
private:
bool
_rover
;
bool
_rover
;
...
@@ -75,7 +75,6 @@ private:
...
@@ -75,7 +75,6 @@ private:
QVariantList
_rgChannelOptionEnabled
;
QVariantList
_rgChannelOptionEnabled
;
QStringList
_simpleModeNames
;
QStringList
_simpleModeNames
;
int
_simpleMode
;
int
_simpleMode
;
QList
<
Fact
*>
_rgFltModeFacts
;
Fact
*
_simpleModeFact
;
Fact
*
_simpleModeFact
;
Fact
*
_superSimpleModeFact
;
Fact
*
_superSimpleModeFact
;
bool
_simpleModesSupported
;
bool
_simpleModesSupported
;
...
...
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