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
d79eb1aa
Unverified
Commit
d79eb1aa
authored
May 26, 2018
by
Don Gagne
Committed by
GitHub
May 26, 2018
Browse files
Merge pull request #6510 from mavlink/sensors_optional_mag
Sensor Cal: Handle case where no mag present [continued]
parents
814358dc
2487abfb
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/AutoPilotPlugins/PX4/SensorsComponent.cc
View file @
d79eb1aa
...
...
@@ -20,11 +20,14 @@ const char* SensorsComponent::_airspeedBreakerParam = "CBRK_AIRSPD_CHK";
const
char
*
SensorsComponent
::
_airspeedDisabledParam
=
"FW_ARSP_MODE"
;
const
char
*
SensorsComponent
::
_airspeedCalParam
=
"SENS_DPRES_OFF"
;
const
char
*
SensorsComponent
::
_magEnabledParam
=
"SYS_HAS_MAG"
;
const
char
*
SensorsComponent
::
_magCalParam
=
"CAL_MAG0_ID"
;
SensorsComponent
::
SensorsComponent
(
Vehicle
*
vehicle
,
AutoPilotPlugin
*
autopilot
,
QObject
*
parent
)
:
VehicleComponent
(
vehicle
,
autopilot
,
parent
),
_name
(
tr
(
"Sensors"
))
{
_deviceIds
<<
QStringLiteral
(
"CAL_MAG0_ID"
)
<<
QStringLiteral
(
"CAL_GYRO0_ID"
)
<<
QStringLiteral
(
"CAL_ACC0_ID"
);
_deviceIds
<<
QStringLiteral
(
"CAL_GYRO0_ID"
)
<<
QStringLiteral
(
"CAL_ACC0_ID"
);
}
QString
SensorsComponent
::
name
(
void
)
const
...
...
@@ -54,6 +57,14 @@ bool SensorsComponent::setupComplete(void) const
return
false
;
}
}
bool
magEnabled
=
true
;
if
(
_vehicle
->
parameterManager
()
->
parameterExists
(
FactSystem
::
defaultComponentId
,
_magEnabledParam
))
{
magEnabled
=
_vehicle
->
parameterManager
()
->
getParameter
(
FactSystem
::
defaultComponentId
,
_magEnabledParam
)
->
rawValue
().
toBool
();
}
if
(
magEnabled
&&
_vehicle
->
parameterManager
()
->
getParameter
(
FactSystem
::
defaultComponentId
,
_magCalParam
)
->
rawValue
().
toFloat
()
==
0.0
f
)
{
return
false
;
}
if
(
_vehicle
->
fixedWing
()
||
_vehicle
->
vtol
())
{
if
(
!
_vehicle
->
parameterManager
()
->
getParameter
(
FactSystem
::
defaultComponentId
,
_airspeedDisabledParam
)
->
rawValue
().
toBool
()
&&
...
...
@@ -70,7 +81,7 @@ QStringList SensorsComponent::setupCompleteChangedTriggerList(void) const
{
QStringList
triggers
;
triggers
<<
_deviceIds
;
triggers
<<
_deviceIds
<<
_magCalParam
<<
_magEnabledParam
;
if
(
_vehicle
->
fixedWing
()
||
_vehicle
->
vtol
())
{
triggers
<<
_airspeedCalParam
<<
_airspeedBreakerParam
;
}
...
...
src/AutoPilotPlugins/PX4/SensorsComponent.h
View file @
d79eb1aa
...
...
@@ -44,6 +44,9 @@ private:
static
const
char
*
_airspeedDisabledParam
;
static
const
char
*
_airspeedBreakerParam
;
static
const
char
*
_airspeedCalParam
;
static
const
char
*
_magEnabledParam
;
static
const
char
*
_magCalParam
;
};
#endif
src/AutoPilotPlugins/PX4/SensorsSetup.qml
View file @
d79eb1aa
...
...
@@ -365,11 +365,12 @@ Item {
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
IndicatorButton
{
property
bool
_hasMag
:
controller
.
parameterExists
(
-
1
,
"
SYS_HAS_MAG
"
)
?
controller
.
getParameterFact
(
-
1
,
"
SYS_HAS_MAG
"
).
value
!==
0
:
true
id
:
compassButton
width
:
_buttonWidth
text
:
qsTr
(
"
Compass
"
)
indicatorGreen
:
cal_mag0_id
.
value
!==
0
visible
:
QGroundControl
.
corePlugin
.
options
.
showSensorCalibrationCompass
&&
showSensorCalibrationCompass
visible
:
_hasMag
&&
QGroundControl
.
corePlugin
.
options
.
showSensorCalibrationCompass
&&
showSensorCalibrationCompass
onClicked
:
{
preCalibrationDialogType
=
"
compass
"
...
...
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