From 040f1463b4801da764fd473c10f93c42a965881b Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Sat, 25 Apr 2026 13:42:49 -0400 Subject: [PATCH] fix(shopfloor): jsQR decode loop diagnostics + attemptBoth + 720p stream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous loop was running but never finding the QR. Three changes to make it actually decode AND make any future failure visible: 1. inversionAttempts: 'dontInvert' -> 'attemptBoth' Some camera exposures wash out the QR enough that jsQR sees it inverted. attemptBoth tries both polarities per frame; the cost is ~2x decode time but jsQR is fast enough that scan stays interactive. 2. getUserMedia now requests 1280x720 (with downgrade allowed). The default 640x480 only gives ~5 pixels per QR module on a typical phone-to-sticker distance — borderline for jsQR. 720p doubles that and makes detection near-instant. 3. The status line is now LIVE, updating every 400ms with: Decoder: jsqr · frames N · attempts M · video WxH rsN So when an operator says "scan does nothing" we can immediately see whether the loop is running, whether the camera is feeding frames, whether jsQR is being called, and at what resolution. No Web Inspector required. Version: shopfloor 19.0.19 -> 19.0.20. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../fusion_plating_shopfloor/__manifest__.py | 2 +- .../static/src/js/qr_scanner.js | 85 +++++++++++++------ 2 files changed, 61 insertions(+), 26 deletions(-) diff --git a/fusion_plating/fusion_plating_shopfloor/__manifest__.py b/fusion_plating/fusion_plating_shopfloor/__manifest__.py index 9d15dd99..ceab2104 100644 --- a/fusion_plating/fusion_plating_shopfloor/__manifest__.py +++ b/fusion_plating/fusion_plating_shopfloor/__manifest__.py @@ -5,7 +5,7 @@ { 'name': 'Fusion Plating — Shop Floor', - 'version': '19.0.19.0.0', + 'version': '19.0.20.0.0', 'category': 'Manufacturing/Plating', 'summary': 'Shop-floor tablet stations, QR scanning, bake window enforcer, ' 'first-piece inspection gates.', diff --git a/fusion_plating/fusion_plating_shopfloor/static/src/js/qr_scanner.js b/fusion_plating/fusion_plating_shopfloor/static/src/js/qr_scanner.js index 38d10cfa..d6c37b1a 100644 --- a/fusion_plating/fusion_plating_shopfloor/static/src/js/qr_scanner.js +++ b/fusion_plating/fusion_plating_shopfloor/static/src/js/qr_scanner.js @@ -112,8 +112,16 @@ export class QrScanner extends Component { return; } try { + // Request a 1280x720 rear-camera stream when possible. The + // browser will downgrade if the device can't deliver it. + // Higher resolution gives jsQR more pixels per QR module + // and dramatically improves decode rate on phones. this.stream = await navigator.mediaDevices.getUserMedia({ - video: { facingMode: { ideal: "environment" } }, + video: { + facingMode: { ideal: "environment" }, + width: { ideal: 1280 }, + height: { ideal: 720 }, + }, audio: false, }); // Wait one paint tick so the t-ref resolves to the