5import QGroundControl.Controls
7import "PX4SensorsRows.js" as SensorsRows
9/// The compass calibration for a vehicle too big to rotate, which sets only the offsets from a known heading and the
10/// vehicle's GPS position. It sits under the six side calibration, collapsed until it is asked for.
14 /// SensorsRows.gpsReadiness()
15 required property var gps
16 property bool open: false
17 /// The firmware's answer to the last calibration, empty before one
18 property string message: ""
19 property bool success: false
20 /// A calibration was requested and the vehicle has not answered yet
21 property bool pending: false
22 signal calibrateRequested(real heading)
23 signal rebootRequested
25 readonly property real _heading: SensorsRows.parseHeading(headingField.text)
26 readonly property bool _headingValid: !isNaN(_heading) && _heading >= 0 && _heading < 360
28 spacing: ScreenTools.defaultFontPixelHeight * 0.5
30 QGCPalette { id: qgcPal }
33 spacing: ScreenTools.defaultFontPixelWidth
34 visible: !control.open
37 text: qsTr("Too big to rotate?")
38 color: qgcPal.textSecondary
42 objectName: "sensorsCal_largeVehicleOpen"
43 text: qsTr("Large vehicle calibration") + " ▸"
47 onTapped: control.open = true
53 Layout.fillWidth: true
54 implicitHeight: formLayout.implicitHeight + ScreenTools.defaultFontPixelHeight
55 radius: ScreenTools.defaultBorderRadius * 2
56 color: qgcPal.windowCard
57 border.color: qgcPal.borderSubtle
63 anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
64 spacing: ScreenTools.defaultFontPixelHeight * 0.5
67 Layout.fillWidth: true
68 spacing: ScreenTools.defaultFontPixelWidth
71 text: qsTr("Large vehicle calibration")
76 text: qsTr("Offsets only")
79 Item { Layout.fillWidth: true }
82 text: qsTr("Hide") + " ▾"
86 onTapped: control.open = false
92 Layout.fillWidth: true
93 wrapMode: Text.WordWrap
94 color: qgcPal.textSecondary
95 text: qsTr("Point the vehicle at a known heading and hold it still. This uses the heading and the GPS position, and is less accurate than calibrating all six sides.")
99 Layout.fillWidth: true
100 spacing: ScreenTools.defaultFontPixelWidth * 2
103 spacing: ScreenTools.defaultFontPixelHeight * 0.15
106 text: qsTr("Heading (0 is true north)")
107 color: qgcPal.textSecondary
108 font.pointSize: ScreenTools.smallFontPointSize
113 objectName: "sensorsCal_headingField"
115 numericValuesOnly: true
117 unitsLabel: qsTr("deg")
118 validationError: !control._headingValid
126 Item { Layout.fillWidth: true }
129 objectName: "sensorsCal_largeVehicleCalibrate"
130 text: qsTr("Calibrate")
132 enabled: control.gps.ready && control._headingValid && !control.pending
133 onClicked: control.calibrateRequested(control._heading)
138 objectName: "sensorsCal_largeVehicleHint"
139 Layout.fillWidth: true
140 wrapMode: Text.WordWrap
141 text: control.message !== "" ? control.message :
142 control.pending ? qsTr("Calibrating…") : (control.gps.ready ? "" : control.gps.message)
143 color: control.message !== "" ? (control.success ? qgcPal.successText : qgcPal.errorText) :
144 control.pending ? qgcPal.textSecondary : qgcPal.errorText
149 objectName: "sensorsCal_largeVehicleReboot"
150 text: qsTr("Reboot vehicle")
152 visible: control.success && control.message !== ""
153 onClicked: control.rebootRequested()