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 _errorPrefix: "<font color=\"" + qgcPal.errorText + "\">"
15 readonly property string _warningPrefix: "<font color=\"" + qgcPal.warningText + "\">"
16 readonly property string _highlightSuffix: "</font>"
17
18 Connections {
19 target: controller
20
21 function onOldFirmware() {
22 textLabel.text = _errorPrefix + qsTr("ESC Calibration failed. ") + _highlightSuffix +
23 qsTr("%1 cannot perform ESC Calibration with this version of firmware. You will need to upgrade to a newer firmware.").arg(QGroundControl.appName)
24 escCalibrationDlg.acceptButtonEnabled = true
25 }
26
27 function onNewerFirmware() {
28 textLabel.text = _errorPrefix + qsTr("ESC Calibration failed. ") + _highlightSuffix +
29 qsTr("%1 cannot perform ESC Calibration with this version of firmware. You will need to upgrade %1.").arg(QGroundControl.appName)
30 escCalibrationDlg.acceptButtonEnabled = true
31 }
32
33 function onDisconnectBattery() {
34 textLabel.text = _errorPrefix + qsTr("ESC Calibration failed. ") + _highlightSuffix +
35 qsTr("You must disconnect the battery prior to performing ESC Calibration. Disconnect your battery and try again.")
36 escCalibrationDlg.acceptButtonEnabled = true
37 }
38
39 function onConnectBattery() {
40 textLabel.text = _warningPrefix + qsTr("WARNING: Props must be removed from vehicle prior to performing ESC calibration.") + _highlightSuffix +
41 qsTr(" Connect the battery now and calibration will begin.")
42 }
43
44 function onBatteryConnected() {
45 textLabel.text = qsTr("Performing calibration. This will take a few seconds..")
46 }
47
48 function onCalibrationFailed(errorMessage) {
49 escCalibrationDlg.acceptButtonEnabled = true
50 textLabel.text = _errorPrefix + qsTr("ESC Calibration failed. ") + _highlightSuffix + errorMessage
51 }
52
53 function onCalibrationSuccess() {
54 escCalibrationDlg.acceptButtonEnabled = true
55 textLabel.text = qsTr("Calibration complete. You can disconnect your battery now if you like.")
56 }
57 }
58
59 Component.onCompleted: controller.calibrateEsc()
60
61 ColumnLayout {
62 QGCLabel {
63 id: textLabel
64 wrapMode: Text.WordWrap
65 text: qsTr("Starting ESC calibration...")
66 Layout.fillWidth: true
67 Layout.maximumWidth: mainWindow.width / 2
68 }
69 }
70}