Skip to content

Commit bafdf43

Browse files
committed
color circle
1 parent 583b754 commit bafdf43

File tree

1 file changed

+35
-27
lines changed

1 file changed

+35
-27
lines changed

src/QmlControls/EscIndicatorPage.qml

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -230,25 +230,30 @@ ToolIndicatorPage {
230230
spacing: ScreenTools.defaultFontPixelHeight * 0.1
231231
Layout.bottomMargin: index < Math.min(4, _allMotors.length) - 1 ? ScreenTools.defaultFontPixelHeight * 0.5 : 0
232232

233+
// Option 1: Compact status with colored circle
233234
RowLayout {
235+
spacing: ScreenTools.defaultFontPixelWidth * 0.5
234236

235237
QGCLabel {
236238
text: qsTr("Motor %1").arg(_allMotors[index].id)
237239
color: qgcPal.text
238240
}
241+
242+
// Small colored circle indicator
243+
Rectangle {
244+
width: ScreenTools.defaultFontPixelHeight * 0.6
245+
height: ScreenTools.defaultFontPixelHeight * 0.6
246+
radius: width / 2
247+
color: _allMotors[index].healthy ? qgcPal.colorGreen : qgcPal.colorRed
248+
}
249+
239250
QGCLabel {
240251
text: _allMotors[index].healthy ? qsTr("ONLINE") : qsTr("OFFLINE")
241252
color: _allMotors[index].healthy ? qgcPal.colorGreen : qgcPal.colorRed
253+
font.pointSize: ScreenTools.smallFontPointSize
242254
}
243255
}
244256

245-
// Rectangle {
246-
// Layout.fillWidth: true
247-
// height: ScreenTools.defaultFontPixelHeight * 0.15
248-
// color: _allMotors[index].healthy ? qgcPal.colorGreen : qgcPal.colorRed
249-
// radius: 2
250-
// }
251-
252257
GridLayout {
253258
Layout.fillWidth: true
254259
columns: 2
@@ -276,20 +281,18 @@ ToolIndicatorPage {
276281
}
277282

278283
LabelledLabel {
279-
// Layout.fillWidth: true
280284
label: qsTr("Errors")
281285
labelText: _allMotors[index].errorCount.toString()
282286
}
283287

284288
// Empty cell
285289
Item { }
286-
287290
}
288291
}
289292
}
290293
}
291294

292-
// Column 2 - Motors 5-8
295+
// Column 2 - Motors 5-8 (consistent with Column 1)
293296
ColumnLayout {
294297
Layout.fillWidth: true
295298
spacing: ScreenTools.defaultFontPixelHeight * 0.25
@@ -302,57 +305,62 @@ ToolIndicatorPage {
302305
spacing: ScreenTools.defaultFontPixelHeight * 0.1
303306
Layout.bottomMargin: index < Math.max(0, _allMotors.length - 4) - 1 ? ScreenTools.defaultFontPixelHeight * 0.5 : 0
304307

305-
QGCLabel {
306-
text: qsTr("Motor %1").arg(_allMotors[index + 4].id)
307-
font.pointSize: ScreenTools.smallFontPointSize
308-
color: qgcPal.text
309-
}
308+
// Consistent with Column 1
309+
RowLayout {
310+
spacing: ScreenTools.defaultFontPixelWidth * 0.5
310311

311-
Rectangle {
312-
Layout.fillWidth: true
313-
height: ScreenTools.defaultFontPixelHeight * 0.15
314-
color: _allMotors[index + 4].healthy ? qgcPal.colorGreen : qgcPal.colorRed
315-
radius: 2
312+
QGCLabel {
313+
text: qsTr("Motor %1").arg(_allMotors[index + 4].id)
314+
color: qgcPal.text
315+
}
316+
317+
Rectangle {
318+
width: ScreenTools.defaultFontPixelHeight * 0.6
319+
height: ScreenTools.defaultFontPixelHeight * 0.6
320+
radius: width / 2
321+
color: _allMotors[index + 4].healthy ? qgcPal.colorGreen : qgcPal.colorRed
322+
}
323+
324+
QGCLabel {
325+
text: _allMotors[index + 4].healthy ? qsTr("ONLINE") : qsTr("OFFLINE")
326+
color: _allMotors[index + 4].healthy ? qgcPal.colorGreen : qgcPal.colorRed
327+
font.pointSize: ScreenTools.smallFontPointSize
328+
}
316329
}
317330

318331
GridLayout {
319332
Layout.fillWidth: true
320333
columns: 2
321334
rowSpacing: 2
322-
columnSpacing: ScreenTools.defaultFontPixelWidth
335+
columnSpacing: ScreenTools.defaultFontPixelWidth * 2
323336

324337
LabelledLabel {
325-
Layout.fillWidth: true
326338
label: qsTr("RPM")
327339
labelText: _allMotors[index + 4].rpm.toString()
328340
}
329341

330342
LabelledLabel {
331-
Layout.fillWidth: true
332343
label: qsTr("Current")
333344
labelText: _allMotors[index + 4].current.toFixed(1) + "A"
334345
}
335346

336347
LabelledLabel {
337-
Layout.fillWidth: true
338348
label: qsTr("Voltage")
339349
labelText: _allMotors[index + 4].voltage.toFixed(1) + "V"
340350
}
341351

342352
LabelledLabel {
343-
Layout.fillWidth: true
344353
label: qsTr("Temp")
345354
labelText: _allMotors[index + 4].temperature > 0 ? _allMotors[index + 4].temperature.toFixed(1) + "°C" : na
346355
}
347356

348357
LabelledLabel {
349-
Layout.fillWidth: true
350358
label: qsTr("Errors")
351359
labelText: _allMotors[index + 4].errorCount.toString()
352360
}
353361

354362
// Empty cell
355-
Item { Layout.fillWidth: true }
363+
Item { }
356364
}
357365
}
358366
}

0 commit comments

Comments
 (0)