feat: add Web Serial API integration to read live weight from MERK scale directly into POS cart items

This commit is contained in:
Flatlogic Bot 2026-02-26 06:04:23 +00:00
parent 33e5df92d8
commit 886df44ae0

View File

@ -6448,10 +6448,10 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System';
const decoder = new TextDecoder('utf-8'); const decoder = new TextDecoder('utf-8');
let readCount = 0; let readCount = 0;
while (readCount < 30) { while (readCount < 100) {
const { value, done } = await Promise.race([ const { value, done } = await Promise.race([
reader.read(), reader.read(),
new Promise((_, reject) => setTimeout(() => reject(new Error('Timeout')), 1000)) new Promise((_, reject) => setTimeout(() => reject(new Error('Timeout')), 500))
]).catch(e => ({ done: true, value: null })); ]).catch(e => ({ done: true, value: null }));
if (done) break; if (done) break;