QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ESCCalibrationDialog.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4
5import QGroundControl
6import QGroundControl.Controls
7
8QGCPopupDialog {
9 id: escCalibrationDlg
10 title: qsTr("ESC Calibration")
11 buttons: Dialog.Ok
12 acceptButtonEnabled: false
13
14 readonly property string _highlightPrefix: "<font color=\"" + qgcPal.warningText + "\">"
15 readonly property string _highlightSuffix: "</font>"
16
17 Connections {
18 target: controller
19
20 function onOldFirmware() {
21 textLabel.text = _highlightPrefix + qsTr("ESC Calibration failed. ") + _highlightSuffix +
22 qsTr("%1 cannot perform ESC Calibration with this version of firmware. You will need to upgrade to a newer firmware.").arg(QGroundControl.appName)
23 escCalibrationDlg.acceptButtonEnabled = true
24 }
25
26 function onNewerFirmware() {
27 textLabel.text = _highlightPrefix + qsTr("ESC Calibration failed. ") + _highlightSuffix +
28 qsTr("%1 cannot perform ESC Calibration with this version of firmware. You will need to upgrade %1.").arg(QGroundControl.appName)
29 escCalibrationDlg.acceptButtonEnabled = true
30 }
31
32 function onDisconnectBattery() {
33 textLabel.text = _highlightPrefix + qsTr("ESC Calibration failed. ") + _highlightSuffix +
34 qsTr("You must disconnect the battery prior to performing ESC Calibration. Disconnect your battery and try again.")
35 escCalibrationDlg.acceptButtonEnabled = true
36 }
37
38 function onConnectBattery() {
39 textLabel.text = _highlightPrefix + qsTr("WARNING: Props must be removed from vehicle prior to performing ESC calibration.") + _highlightSuffix +
40 qsTr(" Connect the battery now and calibration will begin.")
41 }
42
43 function onBatteryConnected() {
44 textLabel.text = qsTr("Performing calibration. This will take a few seconds..")
45 }
46
47 function onCalibrationFailed(errorMessage) {
48 escCalibrationDlg.acceptButtonEnabled = true
49 textLabel.text = _highlightPrefix + qsTr("ESC Calibration failed. ") + _highlightSuffix + errorMessage
50 }
51
52 function onCalibrationSuccess() {
53 escCalibrationDlg.acceptButtonEnabled = true
54 textLabel.text = qsTr("Calibration complete. You can disconnect your battery now if you like.")
55 }
56 }
57
58 Component.onCompleted: controller.calibrateEsc()
59
60 ColumnLayout {
61 QGCLabel {
62 id: textLabel
63 wrapMode: Text.WordWrap
64 text: qsTr("Starting ESC calibration...")
65 Layout.fillWidth: true
66 Layout.maximumWidth: mainWindow.width / 2
67 }
68 }
69}