diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-16 17:03:26 +0200 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-16 17:03:26 +0200 |
| commit | e90b28d8ccb9eedc19c23ebeb0129308a74e2865 (patch) | |
| tree | 0cfdd646986c8ea8b2ecf325ac96fa909db5069a /jetting-interface/Main.qml | |
| parent | bf525d35301dcf0c612598f4394e4357b8378746 (diff) | |
| download | QtXpl2-reality-check.tar.gz QtXpl2-reality-check.zip | |
fix: add workaround for turning all printheads on/offreality-check
Diffstat (limited to 'jetting-interface/Main.qml')
| -rw-r--r-- | jetting-interface/Main.qml | 27 |
1 files changed, 18 insertions, 9 deletions
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; } } |
