5import QGroundControl.Controls
6import QGroundControl.FactControls
8import "PX4ConfigRows.js" as ConfigRows
9import "PX4EscRows.js" as EscRows
13 pageComponent: pageComponent
15 // Parameter values when the page first showed them, so a reboot is only flagged after a change
16 property var _initialValues: Object.create(null)
18 readonly property int _motorCount: {
19 const fact = _fact("CA_ROTOR_COUNT")
20 return fact && fact.rawValue > 0 ? fact.rawValue : 12
22 readonly property var _outputKinds: {
24 for (const name of EscRows.timerParams()) {
25 const fact = _fact(name)
27 protocols.push(fact.rawValue)
30 return EscRows.outputKinds(protocols)
32 readonly property var _rows: ConfigRows.visibleRows(
33 EscRows.escRows(_motorCount),
35 function (name) { return controller.parameterExists(-1, name) })
36 readonly property var _groups: ConfigRows.groupRows(_rows)
38 function _fact(name) {
39 return controller.getParameterFact(-1, name, false)
42 function _rawValue(name) {
43 const fact = _fact(name)
44 return fact ? fact.rawValue : undefined
47 function _rowShown(row) {
48 return EscRows.rowShown(row, _outputKinds)
51 function _groupShown(group) {
52 return group.rows.some(row => _rowShown(row))
57 // Reboot-required settings are marked on the page instead
58 suppressRebootMessage: true
65 QGCPopupDialogFactory {
66 id: escCalibrationDialogFactory
67 dialogComponent: escCalibrationDialogComponent
71 id: escCalibrationDialogComponent
73 ESCCalibrationDialog { }
80 width: Math.max(availableWidth, implicitWidth)
85 Layout.fillWidth: true
86 spacing: ScreenTools.defaultFontPixelHeight * 0.5
87 visible: EscRows.calibrationShown(escPage._outputKinds)
90 text: qsTr("Calibration")
94 objectName: "esc_row_calibration"
95 title: qsTr("PWM calibration")
99 text: qsTr("Teaches ESCs which take a PWM signal the full throttle range. DShot and DroneCAN ESCs do not need it.")
103 color: qgcPal.warningText
104 text: qsTr("Remove the propellers first. Use a USB connection, with the battery disconnected until calibration asks for it.")
107 cellsData: QGCCaptionCell {
109 objectName: "esc_calibrateButton"
110 text: qsTr("Calibrate")
111 onClicked: escCalibrationDialogFactory.open()
118 model: escPage._groups
119 groupShown: escPage._groupShown
120 objectNamePrefix: "esc"
122 rowDelegate: ConfigRow {
124 objectName: "esc_row_" + row.id
128 showSeparator: index > 0
129 visible: escPage._rowShown(row)
131 required property var modelData
132 required property int index
134 readonly property var row: modelData
137 text: rowLayout.row.description
140 cellsData: Repeater {
141 model: rowLayout.row.cells
145 factFor: escPage._fact
146 initialValues: escPage._initialValues
147 objectNamePrefix: "esc"
148 visible: EscRows.cellShown(modelData, escPage._rawValue)
150 required property var modelData