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
a2e9481b
Commit
a2e9481b
authored
Apr 03, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1415 from DonLakeFlyer/OptionalParam
Handle parameters not being available
parents
dbab7381
a8af57ee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
20 deletions
+38
-20
SensorsComponent.qml
src/AutoPilotPlugins/PX4/SensorsComponent.qml
+6
-16
SensorsComponentController.cc
src/AutoPilotPlugins/PX4/SensorsComponentController.cc
+24
-4
SensorsComponentController.h
src/AutoPilotPlugins/PX4/SensorsComponentController.h
+8
-0
No files found.
src/AutoPilotPlugins/PX4/SensorsComponent.qml
View file @
a2e9481b
...
...
@@ -272,16 +272,6 @@ Rectangle {
}
Column
{
property
Fact
cal_mag0_rot
:
Fact
{
name
:
"
CAL_MAG0_ROT
"
}
property
Fact
cal_mag1_rot
:
Fact
{
name
:
"
CAL_MAG1_ROT
"
}
property
Fact
cal_mag2_rot
:
Fact
{
name
:
"
CAL_MAG2_ROT
"
}
// Compass rotation parameter < 0 indicates either internal compass, or no compass. So in
// both those cases we do not show a rotation combo.
property
bool
showCompass0
:
cal_mag0_rot
.
value
>=
0
property
bool
showCompass1
:
cal_mag1_rot
.
value
>=
0
property
bool
showCompass2
:
cal_mag2_rot
.
value
>=
0
x
:
parent
.
width
-
rotationColumnWidth
QGCLabel
{
text
:
"
Autpilot Orientation
"
}
...
...
@@ -309,8 +299,8 @@ Rectangle {
fact
:
Fact
{
name
:
"
CAL_MAG0_ROT
"
}
}
}
Loader
{
sourceComponent
:
parent
.
showCompass0
?
compass0ComponentLabel
:
null
}
Loader
{
sourceComponent
:
parent
.
showCompass0
?
compass0ComponentCombo
:
null
}
Loader
{
sourceComponent
:
controller
.
showCompass0
?
compass0ComponentLabel
:
null
}
Loader
{
sourceComponent
:
controller
.
showCompass0
?
compass0ComponentCombo
:
null
}
// Compass 1 rotation
Component
{
...
...
@@ -328,8 +318,8 @@ Rectangle {
fact
:
Fact
{
name
:
"
CAL_MAG1_ROT
"
}
}
}
Loader
{
sourceComponent
:
parent
.
showCompass1
?
compass1ComponentLabel
:
null
}
Loader
{
sourceComponent
:
parent
.
showCompass1
?
compass1ComponentCombo
:
null
}
Loader
{
sourceComponent
:
controller
.
showCompass1
?
compass1ComponentLabel
:
null
}
Loader
{
sourceComponent
:
controller
.
showCompass1
?
compass1ComponentCombo
:
null
}
// Compass 2 rotation
Component
{
...
...
@@ -347,8 +337,8 @@ Rectangle {
fact
:
Fact
{
name
:
"
CAL_MAG2_ROT
"
}
}
}
Loader
{
sourceComponent
:
parent
.
showCompass2
?
compass2ComponentLabel
:
null
}
Loader
{
sourceComponent
:
parent
.
showCompass2
?
compass2ComponentCombo
:
null
}
Loader
{
sourceComponent
:
controller
.
showCompass2
?
compass2ComponentLabel
:
null
}
Loader
{
sourceComponent
:
controller
.
showCompass2
?
compass2ComponentCombo
:
null
}
}
}
}
...
...
src/AutoPilotPlugins/PX4/SensorsComponentController.cc
View file @
a2e9481b
...
...
@@ -38,6 +38,9 @@ SensorsComponentController::SensorsComponentController(AutoPilotPlugin* autopilo
_progressBar
(
NULL
),
_showGyroCalArea
(
false
),
_showAccelCalArea
(
false
),
_showCompass0
(
false
),
_showCompass1
(
false
),
_showCompass2
(
false
),
_gyroCalInProgress
(
false
),
_accelCalDownSideDone
(
false
),
_accelCalUpsideDownSideDone
(
false
),
...
...
@@ -54,7 +57,16 @@ SensorsComponentController::SensorsComponentController(AutoPilotPlugin* autopilo
_textLoggingStarted
(
false
),
_autopilot
(
autopilot
)
{
Q_ASSERT
(
autopilot
);
Q_ASSERT
(
_autopilot
);
Q_ASSERT
(
_autopilot
->
pluginReady
());
// Mag rotation parameters are optional
_showCompass0
=
_autopilot
->
parameterExists
(
"CAL_MAG0_ROT"
)
&&
_autopilot
->
getParameterFact
(
"CAL_MAG0_ROT"
)
->
value
().
toInt
()
>=
0
;
_showCompass1
=
_autopilot
->
parameterExists
(
"CAL_MAG1_ROT"
)
&&
_autopilot
->
getParameterFact
(
"CAL_MAG1_ROT"
)
->
value
().
toInt
()
>=
0
;
_showCompass2
=
_autopilot
->
parameterExists
(
"CAL_MAG2_ROT"
)
&&
_autopilot
->
getParameterFact
(
"CAL_MAG2_ROT"
)
->
value
().
toInt
()
>=
0
;
}
/// Appends the specified text to the status log area in the ui
...
...
@@ -273,11 +285,19 @@ void SensorsComponentController::_refreshParams(void)
_autopilot
->
refreshParameter
(
FactSystem
::
defaultComponentId
,
"CAL_ACC0_ID"
);
_autopilot
->
refreshParameter
(
FactSystem
::
defaultComponentId
,
"SENS_DPRES_OFF"
);
_autopilot
->
refreshParameter
(
FactSystem
::
defaultComponentId
,
"CAL_MAG0_ROT"
);
_autopilot
->
refreshParameter
(
FactSystem
::
defaultComponentId
,
"CAL_MAG1_ROT"
);
_autopilot
->
refreshParameter
(
FactSystem
::
defaultComponentId
,
"CAL_MAG2_ROT"
);
_autopilot
->
refreshParameter
(
FactSystem
::
defaultComponentId
,
"SENS_BOARD_ROT"
);
// Mag rotation parameters are optional
if
(
_autopilot
->
parameterExists
(
"CAL_MAG0_ROT"
))
{
_autopilot
->
refreshParameter
(
FactSystem
::
defaultComponentId
,
"CAL_MAG0_ROT"
);
}
if
(
_autopilot
->
parameterExists
(
"CAL_MAG1_ROT"
))
{
_autopilot
->
refreshParameter
(
FactSystem
::
defaultComponentId
,
"CAL_MAG1_ROT"
);
}
if
(
_autopilot
->
parameterExists
(
"CAL_MAG2_ROT"
))
{
_autopilot
->
refreshParameter
(
FactSystem
::
defaultComponentId
,
"CAL_MAG2_ROT"
);
}
// Pull full set in order to get all cal values back
_autopilot
->
refreshAllParameters
();
}
...
...
src/AutoPilotPlugins/PX4/SensorsComponentController.h
View file @
a2e9481b
...
...
@@ -51,6 +51,10 @@ public:
Q_PROPERTY
(
QQuickItem
*
accelButton
MEMBER
_accelButton
)
Q_PROPERTY
(
QQuickItem
*
airspeedButton
MEMBER
_airspeedButton
)
Q_PROPERTY
(
bool
showCompass0
MEMBER
_showCompass0
CONSTANT
)
Q_PROPERTY
(
bool
showCompass1
MEMBER
_showCompass1
CONSTANT
)
Q_PROPERTY
(
bool
showCompass2
MEMBER
_showCompass2
CONSTANT
)
Q_PROPERTY
(
bool
showGyroCalArea
MEMBER
_showGyroCalArea
NOTIFY
showGyroCalAreaChanged
)
Q_PROPERTY
(
bool
showAccelCalArea
MEMBER
_showAccelCalArea
NOTIFY
showAccelCalAreaChanged
)
...
...
@@ -110,6 +114,10 @@ private:
bool
_showGyroCalArea
;
bool
_showAccelCalArea
;
bool
_showCompass0
;
bool
_showCompass1
;
bool
_showCompass2
;
bool
_gyroCalInProgress
;
bool
_accelCalDownSideDone
;
...
...
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