From e90b28d8ccb9eedc19c23ebeb0129308a74e2865 Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Tue, 16 Jun 2026 17:03:26 +0200 Subject: fix: add workaround for turning all printheads on/off --- jetting-interface/CommandsPage.qml | 44 +++++++++++++++++++++++++++++++++----- jetting-interface/Main.qml | 27 +++++++++++++++-------- 2 files changed, 57 insertions(+), 14 deletions(-) (limited to 'jetting-interface') diff --git a/jetting-interface/CommandsPage.qml b/jetting-interface/CommandsPage.qml index 5a084e6..5b466f0 100644 --- a/jetting-interface/CommandsPage.qml +++ b/jetting-interface/CommandsPage.qml @@ -163,12 +163,31 @@ ColumnLayout { ColumnLayout { anchors.fill: parent - Button { - text: "Get All PH Versions" + RowLayout { + Layout.fillWidth: true + + Button { + text: "Get All PH Versions" + + onClicked: { + for (let i = 0; i < commandsPage.phModel.count; ++i) + Xpl2Client.getPhVersion(commandsPage.phModel.get(i).phId); + } + } + + // Working replacement for the broken Jetting All On/Off: the + // library self-probes versions then jets each available head by + // ID, even non-contiguous (see docs/DISCREPANCIES.md, D6). + Button { + text: "Jet On All Available" + + onClicked: Xpl2Client.jettingAvailableOn() + } - onClicked: { - for (let i = 0; i < commandsPage.phModel.count; ++i) - Xpl2Client.getPhVersion(commandsPage.phModel.get(i).phId); + Button { + text: "Jet Off All Available" + + onClicked: Xpl2Client.jettingAvailableOff() } } @@ -185,6 +204,7 @@ ColumnLayout { required property int phId required property string versionInfo + required property bool valid width: ListView.view.width @@ -200,6 +220,20 @@ ColumnLayout { onClicked: Xpl2Client.getPhVersion(phDelegate.phId) } + Button { + text: "Jet On" + enabled: phDelegate.valid + + onClicked: Xpl2Client.phJettingOn(phDelegate.phId, "FFFFFFFFFFFF") + } + + Button { + text: "Jet Off" + enabled: phDelegate.valid + + onClicked: Xpl2Client.phJettingOff(phDelegate.phId) + } + Label { Layout.fillWidth: true elide: Text.ElideRight diff --git a/jetting-interface/Main.qml b/jetting-interface/Main.qml index cd69ed8..cd239bb 100644 --- a/jetting-interface/Main.qml +++ b/jetting-interface/Main.qml @@ -20,7 +20,8 @@ ApplicationWindow { for (let i = 1; i <= root.demoPhCount; ++i) phModel.append({ "phId": i, - "versionInfo": "" + "versionInfo": "", + "valid": false }); } @@ -54,16 +55,24 @@ ApplicationWindow { fpgaFirmwareVersion: string, fpgaHardwareVersion: string, bootloaderVersion: string) { + // A printhead is present only if it reports a non-zero version. + // Absent slots reply with all zeros; mcuHardwareVersion and + // mcuFirmwareVariant are "00" even on present heads, so they are + // excluded from the check (see docs/DISCREPANCIES.md). + let isZero = v => parseFloat(v) === 0 || v === ""; + let valid = !(isZero(mcuFirmwareVersion) && isZero(fpgaFirmwareVersion) + && isZero(fpgaHardwareVersion) && isZero(bootloaderVersion)); + let info = valid ? "MCU %1/%2 (%3) | FPGA %4/%5 | Boot %6".arg( + mcuFirmwareVersion).arg( + mcuHardwareVersion).arg( + mcuFirmwareVariant).arg( + fpgaFirmwareVersion).arg( + fpgaHardwareVersion).arg( + bootloaderVersion) : "(Printhead unavailable)"; for (let i = 0; i < phModel.count; ++i) { if (phModel.get(i).phId === printheadId) { - phModel.setProperty(i, "versionInfo", - "MCU %1/%2 (%3) | FPGA %4/%5 | Boot %6".arg( - mcuFirmwareVersion).arg( - mcuHardwareVersion).arg( - mcuFirmwareVariant).arg( - fpgaFirmwareVersion).arg( - fpgaHardwareVersion).arg( - bootloaderVersion)); + phModel.setProperty(i, "versionInfo", info); + phModel.setProperty(i, "valid", valid); break; } } -- cgit v1.3.1