add auto-tare functionality and update scale handling based on touch sensor connection
This commit is contained in:
2025-03-30 16:29:20 +02:00
parent c430c989ef
commit 4dee298b73
6 changed files with 86 additions and 20 deletions
+10
View File
@@ -55,6 +55,8 @@
<h5 class="card-title">Sacle Calibration</h5>
<button id="calibrateBtn" class="btn btn-primary">Calibrate Scale</button>
<button id="tareBtn" class="btn btn-secondary">Tare Scale</button>
&nbsp;&nbsp;&nbsp;Enable Auto-TARE <input type="checkbox" id="autoTareCheckbox" onchange="setAutoTare(this.checked);"
{{autoTare}}>
<div id="statusMessage" class="mt-3"></div>
</div>
</div>
@@ -139,6 +141,14 @@
payload: 'tare'
}));
});
// Add auto-tare function
function setAutoTare(enabled) {
ws.send(JSON.stringify({
type: 'scale',
payload: 'setAutoTare',
enabled: enabled
}));
}
// WebSocket-Verbindung beim Laden der Seite initiieren
connectWebSocket();