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 title: qsTr("Configuration")
60 visible: _motPwmTypeAvailable
65 LabelledFactComboBox {
66 label: qsTr("Output type")
69 comboBoxPreferredWidth: _comboWidth
73 text: _restartRequired
74 font.pointSize: ScreenTools.smallFontPointSize
77 LabelledFactTextField {
78 label: qsTr("Output PWM min")
80 textFieldPreferredWidth: _fieldWidth
81 visible: _motPwmMinAvailable
84 LabelledFactTextField {
85 label: qsTr("Output PWM max")
87 textFieldPreferredWidth: _fieldWidth
88 visible: _motPwmMaxAvailable
91 LabelledFactTextField {
92 label: qsTr("Spin when armed")
94 textFieldPreferredWidth: _fieldWidth
95 visible: _motSpinArmAvailable
98 LabelledFactTextField {
99 label: qsTr("Spin minimum")
101 textFieldPreferredWidth: _fieldWidth
102 visible: _motSpinMinAvailable
105 LabelledFactTextField {
106 label: qsTr("Spin maximum")
108 textFieldPreferredWidth: _fieldWidth
109 visible: _motSpinMaxAvailable
112 // DShot settings - visible when a DShot protocol is selected
113 LabelledFactComboBox {
114 label: qsTr("DShot ESC type")
117 comboBoxPreferredWidth: _comboWidth
118 visible: _isDshot && _servoDshotEscAvailable
121 LabelledFactComboBox {
122 label: qsTr("DShot output rate")
123 fact: _servoDshotRate
125 comboBoxPreferredWidth: _comboWidth
126 visible: _isDshot && _servoDshotRateAvailable
132 title: qsTr("Calibration")
133 visible: _escCalibrationAvailable
139 text: qsTr("WARNING: Remove props prior to calibration!")
140 color: qgcPal.warningText
147 text: qsTr("Calibrate")
148 enabled: _escCalibration && _escCalibration.rawValue === 0
149 onClicked: if(_escCalibration) _escCalibration.rawValue = 3
153 enabled: _escCalibration && _escCalibration.rawValue === 3
154 QGCLabel { text: _escCalibration ? (_escCalibration.rawValue === 3 ? qsTr("Now perform these steps:") : qsTr("Click Calibrate to start, then:")) : "" }
155 QGCLabel { text: qsTr("- Disconnect USB and battery so flight controller powers down") }
156 QGCLabel { text: qsTr("- Connect the battery") }
157 QGCLabel { text: qsTr("- The arming tone will be played (if the vehicle has a buzzer attached)") }
158 QGCLabel { text: qsTr("- If using a flight controller with a safety button press it until it displays solid red") }
159 QGCLabel { text: qsTr("- You will hear a musical tone then two beeps") }
160 QGCLabel { text: qsTr("- A few seconds later you should hear a number of beeps (one for each battery cell you're using)") }
161 QGCLabel { text: qsTr("- And finally a single long beep indicating the end points have been set and the ESC is calibrated") }
162 QGCLabel { text: qsTr("- Disconnect the battery and power up again normally") }
168 } // Component - escPageComponent