5import QGroundControl.Controls
9 anchors.top: parent.top
10 anchors.bottom: parent.bottom
11 width: escIndicatorRow.width
13 property bool showIndicator: _escs.count > 0
15 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
16 property var _escs: _activeVehicle ? _activeVehicle.escs : null
18 // ESC status properties derived from vehicle data
19 property int _motorCount: _escs && _escs.count > 0 ? _escs.get(0).count.rawValue : 0
20 property int _onlineBitmask: _escs && _escs.count > 0? _escs.get(0).info.rawValue : 0
22 property int _onlineMotorCount: _getOnlineMotorCount()
23 property bool _escHealthy: _getEscHealthStatus()
25 function _getOnlineMotorCount() {
26 if (_motorCount === 0) return 0;
29 let mask = _onlineBitmask;
31 // Count all set bits in the bitmask
40 function _getEscHealthStatus() {
41 // Health is good if all expected motors are online and have no failure flags
42 if (_onlineMotorCount !== _motorCount) return false
44 // Check failure flags for each motor (4 per group)
45 for (let index = 0; index < 4; index++) {
46 if ((_onlineBitmask & (1 << index)) !== 0) { // Motor is online
47 if (_escs.get(index).failureFlags > 0) { // Any failure flag set means unhealthy
56 function getEscStatusColor() {
57 return _escHealthy ? qgcPal.colorGreen : qgcPal.colorRed
60 QGCPalette { id: qgcPal }
64 anchors.top: parent.top
65 anchors.bottom: parent.bottom
66 spacing: ScreenTools.defaultFontPixelWidth / 2
71 anchors.top: parent.top
72 anchors.bottom: parent.bottom
73 source: "/qmlimages/EscIndicator.svg"
74 fillMode: Image.PreserveAspectFit
75 sourceSize.height: height
76 color: qgcPal.windowTransparentText
81 anchors.verticalCenter: parent.verticalCenter
85 anchors.horizontalCenter: parent.horizontalCenter
86 color: qgcPal.windowTransparentText
87 text: _onlineMotorCount.toString()
88 font.pointSize: ScreenTools.smallFontPointSize
92 color: getEscStatusColor()
93 text: _escHealthy ? qsTr("OK") : qsTr("ERR")
94 font.pointSize: ScreenTools.smallFontPointSize
101 onClicked: mainWindow.showIndicatorDrawer(escIndicatorPage, control)