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
e1c48fc6
Unverified
Commit
e1c48fc6
authored
Jun 20, 2020
by
Don Gagne
Committed by
GitHub
Jun 20, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8852 from DonLakeFlyer/CompassPriority
ArduPilot: Compass priority support
parents
5ea49f8f
b1860d28
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
99 additions
and
35 deletions
+99
-35
APMSensorsComponent.qml
src/AutoPilotPlugins/APM/APMSensorsComponent.qml
+72
-27
APMSensorParams.qml
src/FirmwarePlugin/APM/APMSensorParams.qml
+12
-4
FirmwareUpgrade.qml
src/VehicleSetup/FirmwareUpgrade.qml
+12
-4
FirmwareUpgradeController.cc
src/VehicleSetup/FirmwareUpgradeController.cc
+2
-0
FirmwareUpgradeController.h
src/VehicleSetup/FirmwareUpgradeController.h
+1
-0
No files found.
src/AutoPilotPlugins/APM/APMSensorsComponent.qml
View file @
e1c48fc6
...
...
@@ -91,6 +91,7 @@ SetupPage {
case
_calTypeCompass
:
_orientationsDialogShowCompass
=
true
_orientationDialogHelp
=
orientationHelpCal
_singleCompassSettingsComponentShowPriority
=
false
dialogTitle
=
qsTr
(
"
Calibrate Compass
"
)
buttons
|=
StandardButton
.
Cancel
break
...
...
@@ -110,6 +111,28 @@ SetupPage {
mainWindow
.
showComponentDialog
(
orientationsDialogComponent
,
dialogTitle
,
mainWindow
.
showDialogDefaultWidth
,
buttons
)
}
function
compassLabel
(
index
)
{
var
label
=
qsTr
(
"
Compass %1
"
).
arg
(
index
+
1
)
var
addOpenParan
=
true
var
addComma
=
false
if
(
sensorParams
.
compassPrimaryFactAvailable
)
{
label
+=
sensorParams
.
rgCompassPrimary
[
index
]
?
qsTr
(
"
(primary
"
)
:
qsTr
(
"
(secondary
"
)
addComma
=
true
addOpenParan
=
false
}
if
(
sensorParams
.
rgCompassExternalParamAvailable
[
index
])
{
if
(
addOpenParan
)
{
label
+=
"
(
"
}
if
(
addComma
)
{
label
+=
qsTr
(
"
,
"
)
}
label
+=
sensorParams
.
rgCompassExternal
[
index
]
?
qsTr
(
"
external
"
)
:
qsTr
(
"
internal
"
)
}
label
+=
"
)
"
return
label
}
APMSensorParams
{
id
:
sensorParams
factPanelController
:
controller
...
...
@@ -142,6 +165,7 @@ SetupPage {
mainWindow
.
showComponentDialog
(
postCalibrationComponent
,
qsTr
(
"
Compass calibration complete
"
),
mainWindow
.
showDialogDefaultWidth
,
StandardButton
.
Ok
)
break
case
APMSensorsComponentController
.
CalTypeOnboardCompass
:
_singleCompassSettingsComponentShowPriority
=
true
mainWindow
.
showComponentDialog
(
postOnboardCompassCalibrationComponent
,
qsTr
(
"
Calibration complete
"
),
mainWindow
.
showDialogDefaultWidth
,
StandardButton
.
Ok
)
break
}
...
...
@@ -189,6 +213,8 @@ SetupPage {
spacing
:
Math
.
round
(
ScreenTools
.
defaultFontPixelHeight
/
2
)
visible
:
sensorParams
.
rgCompassAvailable
[
index
]
&&
sensorParams
.
rgCompassUseFact
[
index
].
value
property
int
_index
:
index
property
real
greenMaxThreshold
:
8
*
(
sensorParams
.
rgCompassExternal
[
index
]
?
1
:
2
)
property
real
yellowMaxThreshold
:
15
*
(
sensorParams
.
rgCompassExternal
[
index
]
?
1
:
2
)
property
real
fitnessRange
:
25
*
(
sensorParams
.
rgCompassExternal
[
index
]
?
1
:
2
)
...
...
@@ -230,26 +256,13 @@ SetupPage {
}
}
Column
{
Loader
{
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
*
2
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
Math
.
round
(
ScreenTools
.
defaultFontPixelHeight
/
4
)
QGCLabel
{
text
:
qsTr
(
"
Compass
"
)
+
(
index
+
1
)
+
"
"
+
(
sensorParams
.
rgCompassPrimary
[
index
]
?
qsTr
(
"
(primary
"
)
:
qsTr
(
"
(secondary
"
))
+
(
sensorParams
.
rgCompassExternalParamAvailable
[
index
]
?
(
sensorParams
.
rgCompassExternal
[
index
]
?
qsTr
(
"
, external
"
)
:
qsTr
(
"
, internal
"
))
:
""
)
+
"
)
"
}
sourceComponent
:
singleCompassSettingsComponent
FactCheckBox
{
text
:
qsTr
(
"
Use Compass
"
)
fact
:
sensorParams
.
rgCompassUseFact
[
index
]
visible
:
sensorParams
.
rgCompassUseParamAvailable
[
index
]
&&
!
sensorParams
.
rgCompassPrimary
[
index
]
}
property
int
index
:
_index
}
}
}
...
...
@@ -314,11 +327,12 @@ SetupPage {
controller
.
vehicle
.
rebootVehicle
()
hideDialog
()
}
}
}
}
}
}
property
bool
_singleCompassSettingsComponentShowPriority
:
true
Component
{
id
:
singleCompassSettingsComponent
...
...
@@ -327,12 +341,7 @@ SetupPage {
visible
:
sensorParams
.
rgCompassAvailable
[
index
]
QGCLabel
{
text
:
qsTr
(
"
Compass
"
)
+
(
index
+
1
)
+
"
"
+
(
sensorParams
.
rgCompassPrimary
[
index
]
?
qsTr
(
"
(primary
"
)
:
qsTr
(
"
(secondary
"
))
+
(
sensorParams
.
rgCompassExternalParamAvailable
[
index
]
?
(
sensorParams
.
rgCompassExternal
[
index
]
?
qsTr
(
"
, external
"
)
:
qsTr
(
"
, internal
"
)
)
:
""
)
+
"
)
"
text
:
compassLabel
(
index
)
}
Column
{
...
...
@@ -340,10 +349,46 @@ SetupPage {
anchors.left
:
parent
.
left
spacing
:
Math
.
round
(
ScreenTools
.
defaultFontPixelHeight
/
4
)
FactCheckBox
{
text
:
qsTr
(
"
Use Compass
"
)
fact
:
sensorParams
.
rgCompassUseFact
[
index
]
visible
:
sensorParams
.
rgCompassUseParamAvailable
[
index
]
&&
!
sensorParams
.
rgCompassPrimary
[
index
]
RowLayout
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
FactCheckBox
{
id
:
useCompassCheckBox
text
:
qsTr
(
"
Use Compass
"
)
fact
:
sensorParams
.
rgCompassUseFact
[
index
]
visible
:
sensorParams
.
rgCompassUseParamAvailable
[
index
]
&&
!
sensorParams
.
rgCompassPrimary
[
index
]
}
QGCComboBox
{
model
:
[
qsTr
(
"
Priority 1
"
),
qsTr
(
"
Priority 2
"
),
qsTr
(
"
Priority 3
"
),
qsTr
(
"
Not Set
"
)
]
visible
:
_singleCompassSettingsComponentShowPriority
&&
sensorParams
.
compassPrioFactsAvailable
&&
useCompassCheckBox
.
visible
&&
useCompassCheckBox
.
checked
property
int
_compassIndex
:
index
function
selectPriorityfromParams
()
{
if
(
visible
)
{
currentIndex
=
3
var
compassId
=
sensorParams
.
rgCompassId
[
_compassIndex
].
rawValue
for
(
var
prioIndex
=
0
;
prioIndex
<
3
;
prioIndex
++
)
{
if
(
compassId
==
sensorParams
.
rgCompassPrio
[
prioIndex
].
rawValue
)
{
currentIndex
=
prioIndex
break
}
}
}
}
Component.onCompleted
:
selectPriorityfromParams
()
onActivated
:
{
if
(
index
==
3
)
{
// User cannot select Not Set
selectPriorityfromParams
()
}
else
{
sensorParams
.
rgCompassPrio
[
index
].
rawValue
=
sensorParams
.
rgCompassId
[
_compassIndex
].
rawValue
}
}
}
}
Column
{
...
...
src/FirmwarePlugin/APM/APMSensorParams.qml
View file @
e1c48fc6
...
...
@@ -17,15 +17,23 @@ Item {
property
Fact
_noFact
:
Fact
{
}
property
Fact
compassPrimaryFact
:
factPanelController
.
getParameterFact
(
-
1
,
"
COMPASS_PRIMARY
"
)
property
bool
compass1Primary
:
compassPrimaryFact
.
rawValue
==
0
property
bool
compass2Primary
:
compassPrimaryFact
.
rawValue
==
1
property
bool
compass3Primary
:
compassPrimaryFact
.
rawValue
==
2
property
bool
compassPrimaryFactAvailable
:
factPanelController
.
parameterExists
(
-
1
,
"
COMPASS_PRIMARY
"
)
property
Fact
compassPrimaryFact
:
compassPrimaryFactAvailable
?
factPanelController
.
getParameterFact
(
-
1
,
"
COMPASS_PRIMARY
"
)
:
_noFact
property
bool
compass1Primary
:
compassPrimaryFactAvailable
?
compassPrimaryFact
.
rawValue
==
0
:
false
property
bool
compass2Primary
:
compassPrimaryFactAvailable
?
compassPrimaryFact
.
rawValue
==
1
:
false
property
bool
compass3Primary
:
compassPrimaryFactAvailable
?
compassPrimaryFact
.
rawValue
==
2
:
false
property
var
rgCompassPrimary
:
[
compass1Primary
,
compass2Primary
,
compass3Primary
]
property
Fact
compass1Id
:
factPanelController
.
getParameterFact
(
-
1
,
"
COMPASS_DEV_ID
"
)
property
Fact
compass2Id
:
factPanelController
.
getParameterFact
(
-
1
,
"
COMPASS_DEV_ID2
"
)
property
Fact
compass3Id
:
factPanelController
.
getParameterFact
(
-
1
,
"
COMPASS_DEV_ID3
"
)
property
var
rgCompassId
:
[
compass1Id
,
compass2Id
,
compass3Id
]
property
bool
compassPrioFactsAvailable
:
factPanelController
.
parameterExists
(
-
1
,
"
COMPASS_PRIO1_ID
"
)
property
Fact
compassPrio1Fact
:
compassPrioFactsAvailable
?
factPanelController
.
getParameterFact
(
-
1
,
"
COMPASS_PRIO1_ID
"
)
:
_noFact
property
Fact
compassPrio2Fact
:
compassPrioFactsAvailable
?
factPanelController
.
getParameterFact
(
-
1
,
"
COMPASS_PRIO2_ID
"
)
:
_noFact
property
Fact
compassPrio3Fact
:
compassPrioFactsAvailable
?
factPanelController
.
getParameterFact
(
-
1
,
"
COMPASS_PRIO3_ID
"
)
:
_noFact
property
var
rgCompassPrio
:
[
compassPrio1Fact
,
compassPrio2Fact
,
compassPrio3Fact
]
property
bool
compass1Available
:
compass1Id
.
value
>
0
property
bool
compass2Available
:
compass2Id
.
value
>
0
...
...
src/VehicleSetup/FirmwareUpgrade.qml
View file @
e1c48fc6
...
...
@@ -28,8 +28,6 @@ SetupPage {
pageName
:
qsTr
(
"
Firmware
"
)
showAdvanced
:
activeVehicle
&&
activeVehicle
.
apmFirmware
signal
cancelDialog
Component
{
id
:
firmwarePageComponent
...
...
@@ -135,15 +133,20 @@ SetupPage {
}
else
{
// We end up here when we detect a board plugged in after we've started upgrade
statusTextArea
.
append
(
highlightPrefix
+
qsTr
(
"
Found device
"
)
+
highlightSuffix
+
"
:
"
+
controller
.
boardType
)
if
(
controller
.
p
ixhawkBoard
||
controller
.
p
x4FlowBoard
)
{
if
(
controller
.
px4FlowBoard
)
{
mainWindow
.
showComponentDialog
(
pixhawkFirmwareSelectDialogComponent
,
title
,
mainWindow
.
showDialogDefaultWidth
,
StandardButton
.
Ok
|
StandardButton
.
Cancel
)
}
}
}
onBootloaderFound
:
{
if
(
controller
.
pixhawkBoard
)
{
mainWindow
.
showComponentDialog
(
pixhawkFirmwareSelectDialogComponent
,
title
,
mainWindow
.
showDialogDefaultWidth
,
StandardButton
.
Ok
|
StandardButton
.
Cancel
)
}
}
onError
:
{
statusTextArea
.
append
(
flashFailText
)
firmwarePage
.
cancelDialog
()
}
}
...
...
@@ -191,6 +194,11 @@ SetupPage {
updatePX4VersionDisplay
()
}
Connections
{
target
:
controller
onError
:
reject
()
}
function
accept
()
{
if
(
_singleFirmwareMode
)
{
controller
.
flashSingleFirmwareMode
(
controller
.
selectedFirmwareBuildType
)
...
...
src/VehicleSetup/FirmwareUpgradeController.cc
View file @
e1c48fc6
...
...
@@ -245,6 +245,8 @@ void FirmwareUpgradeController::_foundBootloader(int bootloaderVersion, int boar
if
(
_rgManifestFirmwareInfo
.
count
())
{
_buildAPMFirmwareNames
();
}
emit
bootloaderFound
();
}
...
...
src/VehicleSetup/FirmwareUpgradeController.h
View file @
e1c48fc6
...
...
@@ -156,6 +156,7 @@ public:
signals:
void
boardFound
(
void
);
void
bootloaderFound
(
void
);
void
noBoardFound
(
void
);
void
boardGone
(
void
);
void
flashComplete
(
void
);
...
...
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