diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponent.qml b/src/AutoPilotPlugins/APM/APMSensorsComponent.qml index c05116e..1bc451c 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponent.qml +++ b/src/AutoPilotPlugins/APM/APMSensorsComponent.qml @@ -446,6 +446,37 @@ SetupPage { model: _orientationsDialogShowCompass ? 3 : 0 delegate: singleCompassSettingsComponent } + + QGCLabel { + id: magneticDeclinationLabel + width: parent.width + visible: globals.activeVehicle.sub && _orientationsDialogShowCompass + text: qsTr("Magnetic Declination") + } + + Column { + visible: magneticDeclinationLabel.visible + anchors.margins: ScreenTools.defaultFontPixelWidth + anchors.left: parent.left + anchors.right: parent.right + spacing: ScreenTools.defaultFontPixelHeight + + QGCCheckBox { + id: manualMagneticDeclinationCheckBox + text: qsTr("Manual Magnetic Declination") + property Fact autoDecFact: controller.getParameterFact(-1, "COMPASS_AUTODEC") + property int manual: 0 + property int automatic: 1 + + checked: autoDecFact.rawValue === manual + onClicked: autoDecFact.value = (checked ? manual : automatic) + } + + FactTextField { + fact: sensorParams.declinationFact + enabled: manualMagneticDeclinationCheckBox.checked + } + } } // Column } // QGCFlickable } // QGCViewDialog diff --git a/src/FirmwarePlugin/APM/APMSensorParams.qml b/src/FirmwarePlugin/APM/APMSensorParams.qml index f6c4058..1f00b04 100644 --- a/src/FirmwarePlugin/APM/APMSensorParams.qml +++ b/src/FirmwarePlugin/APM/APMSensorParams.qml @@ -92,4 +92,6 @@ Item { property bool compass2Calibrated: compass2Available ? compass2OfsXFact.value != 0.0 && compass2OfsYFact.value != 0.0 &&compass2OfsZFact.value != 0.0 : false property bool compass3Calibrated: compass3Available ? compass3OfsXFact.value != 0.0 && compass3OfsYFact.value != 0.0 &&compass3OfsZFact.value != 0.0 : false property var rgCompassCalibrated: [ compass1Calibrated, compass2Calibrated, compass3Calibrated ] + + property Fact declinationFact: factPanelController.getParameterFact(-1, "COMPASS_DEC") }