diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-03-16 16:19:49 +0100 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-03-16 16:19:49 +0100 |
| commit | fa095de6cc8ec5a5b5c14091f2b3179ad7071876 (patch) | |
| tree | aa094011263a83a4c91eb8722c2095344656c838 /demo/StatusPage.qml | |
| parent | 7830f0ae98d742467b948ed93c85e122be38fb83 (diff) | |
| download | QtXpl2-fa095de6cc8ec5a5b5c14091f2b3179ad7071876.tar.gz QtXpl2-fa095de6cc8ec5a5b5c14091f2b3179ad7071876.zip | |
EV_ events with Q_GADGET status types, mock periodic emission, tabbed demo UI
Diffstat (limited to 'demo/StatusPage.qml')
| -rw-r--r-- | demo/StatusPage.qml | 620 |
1 files changed, 620 insertions, 0 deletions
diff --git a/demo/StatusPage.qml b/demo/StatusPage.qml new file mode 100644 index 0000000..6a85bcc --- /dev/null +++ b/demo/StatusPage.qml @@ -0,0 +1,620 @@ +pragma ComponentBehavior: Bound + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Xpl2 + +ColumnLayout { + id: statusPage + + property var lastJcStatus: null + property var lastPhStatus: null + + spacing: 12 + + // --- Status Messaging Controls --- + GroupBox { + Layout.fillWidth: true + enabled: Xpl2Client.connected + title: "Status Messaging" + + GridLayout { + anchors.fill: parent + columns: 2 + + Label { + text: "Level:" + } + + ComboBox { + id: statusLevelCombo + + Layout.fillWidth: true + model: ["1 — Basic", "2 — Extended"] + } + + Label { + text: "Interval (ms):" + } + + SpinBox { + id: statusIntervalSpin + + Layout.fillWidth: true + from: 100 + stepSize: 100 + to: 10000 + value: 1000 + } + + Button { + text: "Start JC Status" + + onClicked: Xpl2Client.jcStatusMessagingStart( + statusLevelCombo.currentIndex + 1, + statusIntervalSpin.value) + } + + Button { + text: "Stop JC Status" + + onClicked: Xpl2Client.jcStatusMessagingStop() + } + + Button { + text: "Start PH Status" + + onClicked: Xpl2Client.phStatusMessagingStart( + statusLevelCombo.currentIndex + 1, + statusIntervalSpin.value) + } + + Button { + text: "Stop PH Status" + + onClicked: Xpl2Client.phStatusMessagingStop() + } + } + } + + // --- JC Status Display --- + GroupBox { + Layout.fillWidth: true + title: "JC Status" + + RowLayout { + anchors.fill: parent + + GridLayout { + Layout.fillWidth: true + columns: 4 + + Label { + font.bold: true + text: "CPU:" + } + + Label { + text: statusPage.lastJcStatus + ? statusPage.lastJcStatus.cpuPercentageBusy.toFixed( + 1) + "%" : "—" + } + + Label { + font.bold: true + text: "Temp:" + } + + Label { + text: statusPage.lastJcStatus + ? statusPage.lastJcStatus.temperature.toFixed(1) + + "°C" : "—" + } + + Label { + font.bold: true + text: "Rail 5V:" + } + + Label { + text: statusPage.lastJcStatus + ? statusPage.lastJcStatus.rail5V.toFixed(2) + "V" : + "—" + } + + Label { + font.bold: true + text: "CAN 8V:" + } + + Label { + text: statusPage.lastJcStatus + ? statusPage.lastJcStatus.railCanBus8V.toFixed(2) + + "V" : "—" + } + + Label { + font.bold: true + text: "Humidity:" + } + + Label { + text: statusPage.lastJcStatus + ? statusPage.lastJcStatus.humidity.toFixed(1) + "%" : + "—" + } + + Label { + font.bold: true + text: "Bus I:" + } + + Label { + text: statusPage.lastJcStatus + ? statusPage.lastJcStatus.busCurrent.toFixed(3) + "A" : + "—" + } + + Label { + font.bold: true + text: "Uptime:" + } + + Label { + text: statusPage.lastJcStatus + ? statusPage.lastJcStatus.onTimeSeconds + "s" : "—" + } + } + + // --- Extended (Level 2) --- + GridLayout { + Layout.fillWidth: true + columns: 4 + visible: statusPage.lastJcStatus !== null + && statusPage.lastJcStatus.statusLevel >= 2 + + Label { + font.bold: true + text: "IP:" + } + + Label { + text: statusPage.lastJcStatus + ? statusPage.lastJcStatus.ipAddress : "—" + } + + Label { + font.bold: true + text: "eFuse V:" + } + + Label { + text: statusPage.lastJcStatus + ? statusPage.lastJcStatus.eFuseVoltage.toFixed(2) + + "V" : "—" + } + + Label { + font.bold: true + text: "eFuse Bus:" + } + + Label { + text: statusPage.lastJcStatus ? ( + statusPage.lastJcStatus.eFuseBusEnabled + ? "On" : "Off") : "—" + } + + Label { + font.bold: true + text: "Bus Power:" + } + + Label { + text: statusPage.lastJcStatus ? ( + statusPage.lastJcStatus.busPowerEnabled + ? "On" : "Off") : "—" + } + + Label { + font.bold: true + text: "Bus OK:" + } + + Label { + text: statusPage.lastJcStatus ? ( + statusPage.lastJcStatus.busPowerOk + ? "Yes" : "No") : "—" + } + + Label { + font.bold: true + text: "Switch:" + } + + Label { + text: statusPage.lastJcStatus ? String( + statusPage.lastJcStatus.switchValue) : + "—" + } + + Label { + font.bold: true + text: "FW:" + } + + Label { + text: statusPage.lastJcStatus + ? statusPage.lastJcStatus.firmwareVersion : "—" + } + + Label { + font.bold: true + text: "HW:" + } + + Label { + text: statusPage.lastJcStatus + ? statusPage.lastJcStatus.hardwareVersion : "—" + } + + Label { + font.bold: true + text: "Indicators:" + } + + Label { + Layout.columnSpan: 3 + text: statusPage.lastJcStatus + ? [statusPage.lastJcStatus.indicator0, + statusPage.lastJcStatus.indicator1, + statusPage.lastJcStatus.indicator2, + statusPage.lastJcStatus.indicator3, + statusPage.lastJcStatus.indicator4, + statusPage.lastJcStatus.indicator5].map(function ( + v) { + return v ? "1" : "0"; + }).join(" ") : "—" + } + } + } + } + + // --- PH Status Display --- + GroupBox { + Layout.fillHeight: true + Layout.fillWidth: true + title: "PH Status" + + RowLayout { + anchors.fill: parent + + GridLayout { + Layout.fillWidth: true + columns: 4 + + Label { + font.bold: true + text: "PH:" + } + + Label { + text: statusPage.lastPhStatus ? String( + statusPage.lastPhStatus.printheadId) : + "—" + } + + Label { + font.bold: true + text: "Temp:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.temperature.toFixed(1) + + "°C" : "—" + } + + Label { + font.bold: true + text: "MCU Temp:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.mcuTemperature.toFixed(1) + + "°C" : "—" + } + + Label { + font.bold: true + text: "Humidity:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.humidity.toFixed(1) + "%" : + "—" + } + + Label { + font.bold: true + text: "PDS V:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.pdsVoltage.toFixed(2) + "V" : + "—" + } + + Label { + font.bold: true + text: "MDS V:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.mdsVoltage.toFixed(2) + "V" : + "—" + } + + Label { + font.bold: true + text: "Sys V:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.systemVoltage.toFixed(2) + + "V" : "—" + } + + Label { + font.bold: true + text: "VDD:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.vdd.toFixed(2) + "V" : "—" + } + + Label { + font.bold: true + text: "eFuse I:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.eFuseCurrent.toFixed(3) + + "A" : "—" + } + + Label { + font.bold: true + text: "Nozzle I:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.nozzleCurrent.toFixed(3) + + "A" : "—" + } + + Label { + font.bold: true + text: "Duty Cycle:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.dutyCycle.toFixed(1) + "%" : + "—" + } + + Label { + font.bold: true + text: "Drive:" + } + + Label { + text: statusPage.lastPhStatus ? String( + statusPage.lastPhStatus.drive) : + "—" + } + + Label { + font.bold: true + text: "Uptime:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.onTimeSeconds + "s" : "—" + } + } + + // --- Extended (Level 2) --- + GridLayout { + Layout.fillWidth: true + columns: 4 + visible: statusPage.lastPhStatus !== null + && statusPage.lastPhStatus.statusLevel >= 2 + + Label { + font.bold: true + text: "MCU FW:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.mcuFirmwareVersion : "—" + } + + Label { + font.bold: true + text: "MCU HW:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.mcuHardwareVersion : "—" + } + + Label { + font.bold: true + text: "MCU Variant:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.mcuFirmwareVariant : "—" + } + + Label { + font.bold: true + text: "FPGA FW:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.fpgaFirmwareVersion : "—" + } + + Label { + font.bold: true + text: "FPGA HW:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.fpgaHardwareVersion : "—" + } + + Label { + font.bold: true + text: "Boot:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.bootloaderVersion : "—" + } + + Label { + font.bold: true + text: "Max Temp:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.maxAllowedTemperature.toFixed( + 1) + "°C" : "—" + } + + Label { + font.bold: true + text: "eFuse Max:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.eFuseCurrentMax.toFixed(2) + + "A" : "—" + } + + Label { + font.bold: true + text: "PDS V Max:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.pdsVoltageMax.toFixed(2) + + "V" : "—" + } + + Label { + font.bold: true + text: "PDS V Min:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.pdsVoltageMin.toFixed(2) + + "V" : "—" + } + + Label { + font.bold: true + text: "MDS V Max:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.mdsVoltageMax.toFixed(2) + + "V" : "—" + } + + Label { + font.bold: true + text: "MDS V Min:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.mdsVoltageMin.toFixed(2) + + "V" : "—" + } + + Label { + font.bold: true + text: "Meas. HW:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.measuredHardwareVersion : + "—" + } + + Label { + font.bold: true + text: "Accel ID:" + } + + Label { + text: statusPage.lastPhStatus ? String( + statusPage.lastPhStatus.accelerometerId) : + "—" + } + + Label { + font.bold: true + text: "Gyro:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.gyroX + ", " + + statusPage.lastPhStatus.gyroY + ", " + + statusPage.lastPhStatus.gyroZ : "—" + } + + Label { + font.bold: true + text: "Accel:" + } + + Label { + text: statusPage.lastPhStatus + ? statusPage.lastPhStatus.accelerationX + ", " + + statusPage.lastPhStatus.accelerationY + ", " + + statusPage.lastPhStatus.accelerationZ : "—" + } + } + } + } +} |
