6import QGroundControl.FactControls
7import QGroundControl.Controls
11 pageComponent: escPageComponent
24 // ESC Configuration properties - supports both MOT_* (Copter/Rover/Sub) and Q_M_* (QuadPlane) prefixes
25 property bool _isQuadPlane: !controller.parameterExists(-1, "MOT_PWM_TYPE") && controller.parameterExists(-1, "Q_M_PWM_TYPE")
26 property string _escPrefix: _isQuadPlane ? "Q_M_" : "MOT_"
28 property bool _motPwmTypeAvailable: controller.parameterExists(-1, _escPrefix + "PWM_TYPE")
29 property bool _motPwmMinAvailable: controller.parameterExists(-1, _escPrefix + "PWM_MIN")
30 property bool _motPwmMaxAvailable: controller.parameterExists(-1, _escPrefix + "PWM_MAX")
31 property bool _motSpinArmAvailable: controller.parameterExists(-1, _escPrefix + "SPIN_ARM")
32 property bool _motSpinMinAvailable: controller.parameterExists(-1, _escPrefix + "SPIN_MIN")
33 property bool _motSpinMaxAvailable: controller.parameterExists(-1, _escPrefix + "SPIN_MAX")
34 property bool _servoDshotEscAvailable: controller.parameterExists(-1, "SERVO_DSHOT_ESC")
35 property bool _servoDshotRateAvailable: controller.parameterExists(-1, "SERVO_DSHOT_RATE")
37 property Fact _motPwmType: controller.getParameterFact(-1, _escPrefix + "PWM_TYPE", false /* reportMissing */)
38 property Fact _motPwmMin: controller.getParameterFact(-1, _escPrefix + "PWM_MIN", false /* reportMissing */)
39 property Fact _motPwmMax: controller.getParameterFact(-1, _escPrefix + "PWM_MAX", false /* reportMissing */)
40 property Fact _motSpinArm: controller.getParameterFact(-1, _escPrefix + "SPIN_ARM", false /* reportMissing */)
41 property Fact _motSpinMin: controller.getParameterFact(-1, _escPrefix + "SPIN_MIN", false /* reportMissing */)
42 property Fact _motSpinMax: controller.getParameterFact(-1, _escPrefix + "SPIN_MAX", false /* reportMissing */)
43 property Fact _servoDshotEsc: controller.getParameterFact(-1, "SERVO_DSHOT_ESC", false /* reportMissing */)
44 property Fact _servoDshotRate: controller.getParameterFact(-1, "SERVO_DSHOT_RATE", false /* reportMissing */)
46 property bool _isDshot: _motPwmTypeAvailable && _motPwmType && _motPwmType.rawValue >= 4
48 property string _escCalParam: _isQuadPlane ? "Q_ESC_CAL" : "ESC_CALIBRATION"
49 property bool _escCalibrationAvailable: controller.parameterExists(-1, _escCalParam)
50 property Fact _escCalibration: controller.getParameterFact(-1, _escCalParam, false /* reportMissing */)
52 property string _restartRequired: qsTr("Requires vehicle reboot")
53 property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 15
54 property real _comboWidth: ScreenTools.defaultFontPixelWidth * 30
56 QGCPalette { id: qgcPal; colorGroupEnabled: true }
59 Layout.fillWidth: false
60 heading: qsTr("Configuration")
61 visible: _motPwmTypeAvailable
66 LabelledFactComboBox {
67 label: qsTr("Output type")
70 comboBoxPreferredWidth: _comboWidth
74 text: _restartRequired
75 font.pointSize: ScreenTools.smallFontPointSize
78 LabelledFactTextField {
79 label: qsTr("Output PWM min")
81 textFieldPreferredWidth: _fieldWidth
82 visible: _motPwmMinAvailable
85 LabelledFactTextField {
86 label: qsTr("Output PWM max")
88 textFieldPreferredWidth: _fieldWidth
89 visible: _motPwmMaxAvailable
92 LabelledFactTextField {
93 label: qsTr("Spin when armed")
95 textFieldPreferredWidth: _fieldWidth
96 visible: _motSpinArmAvailable
99 LabelledFactTextField {
100 label: qsTr("Spin minimum")
102 textFieldPreferredWidth: _fieldWidth
103 visible: _motSpinMinAvailable
106 LabelledFactTextField {
107 label: qsTr("Spin maximum")
109 textFieldPreferredWidth: _fieldWidth
110 visible: _motSpinMaxAvailable
113 // DShot settings - visible when a DShot protocol is selected
114 LabelledFactComboBox {
115 label: qsTr("DShot ESC type")
118 comboBoxPreferredWidth: _comboWidth
119 visible: _isDshot && _servoDshotEscAvailable
122 LabelledFactComboBox {
123 label: qsTr("DShot output rate")
124 fact: _servoDshotRate
126 comboBoxPreferredWidth: _comboWidth
127 visible: _isDshot && _servoDshotRateAvailable
133 Layout.fillWidth: false
134 heading: qsTr("Calibration")
135 visible: _escCalibrationAvailable
141 text: qsTr("WARNING: Remove props prior to calibration!")
142 color: qgcPal.warningText
149 text: qsTr("Calibrate")
150 enabled: _escCalibration && _escCalibration.rawValue === 0
151 onClicked: if(_escCalibration) _escCalibration.rawValue = 3
155 enabled: _escCalibration && _escCalibration.rawValue === 3
156 QGCLabel { text: _escCalibration ? (_escCalibration.rawValue === 3 ? qsTr("Now perform these steps:") : qsTr("Click Calibrate to start, then:")) : "" }
157 QGCLabel { text: qsTr("- Disconnect USB and battery so flight controller powers down") }
158 QGCLabel { text: qsTr("- Connect the battery") }
159 QGCLabel { text: qsTr("- The arming tone will be played (if the vehicle has a buzzer attached)") }
160 QGCLabel { text: qsTr("- If using a flight controller with a safety button press it until it displays solid red") }
161 QGCLabel { text: qsTr("- You will hear a musical tone then two beeps") }
162 QGCLabel { text: qsTr("- A few seconds later you should hear a number of beeps (one for each battery cell you're using)") }
163 QGCLabel { text: qsTr("- And finally a single long beep indicating the end points have been set and the ESC is calibrated") }
164 QGCLabel { text: qsTr("- Disconnect the battery and power up again normally") }
170 } // Component - escPageComponent