succd: implement threshold outputs, rework processing

This commit is contained in:
Serge Bazanski 2024-09-27 02:11:04 +02:00
parent 781bbaaeb4
commit 6d97eb62a8
5 changed files with 323 additions and 167 deletions

View file

@ -36,6 +36,10 @@ button {
padding-right: 1.5em;
}
td > span {
padding: 0.2em;
}
.logo {
float: left;
margin-right: 2em;
@ -55,23 +59,29 @@ button {
<table>
<tr>
<th>Voltage</th>
<td id="volts">{{.volts}}</td>
<td id="volts" colspan="4">{{.volts}}</td>
</tr>
<tr>
<th>Pressure</th>
<td id="mbar">{{.mbar}}</td>
<td id="mbar" colspan="4">{{.mbar}}</td>
</tr>
<tr>
<th>Thresholds</th>
<td>Rough:</td>
<td id="trough">...</td>
<td>High:</td>
<td id="thigh">...</td>
</tr>
<tr>
<th>Roughing Pump</th>
<td id="rp">{{ if .rp }}ON{{ else }}OFF{{ end }}</td>
</tr>
<tr>
<th>Diffusion Pump</th>
<td id="dp">{{ if .dp }}ON{{ else }}OFF{{ end }}</td>
<th>Pumps</th>
<td>RP:</td>
<td id="rp">{{ if .rp }}ON{{ else }}OFF{{ end }}</td>
<td>DP:</td>
<td id="dp">{{ if .dp }}ON{{ else }}OFF{{ end }}</td>
</tr>
<tr>
<th>Evac Control</th>
<td>
<td colspan="4">
<button id="pd">Pump Down</button>
<button id="vent">Vent</button>
<button id="rpon">RP On</button>
@ -82,7 +92,7 @@ button {
</tr>
<tr>
<th>Status</th>
<td id="status">OK</td>
<td id="status" colspan="4">OK</td>
</tr>
</table>
</p>
@ -233,6 +243,8 @@ window.addEventListener("load", (_) => {
let volts = document.querySelector("#volts");
let mbar = document.querySelector("#mbar");
let ping = document.querySelector("#ping");
let trough = document.querySelector("#trough");
let thigh = document.querySelector("#thigh");
// Buttons
let pd = document.querySelector("#pd");
@ -280,6 +292,22 @@ window.addEventListener("load", (_) => {
} else {
dp.style = "background-color: #f06060";
}
let t = [];
if (data.RoughReached) {
trough.innerHTML = "OK";
trough.style = "background-color: #60f060";
} else {
trough.innerHTML = "NOK";
trough.style = "background-color: #f06060";
}
if (data.HighReached) {
thigh.innerHTML = "OK";
thigh.style = "background-color: #60f060";
} else {
thigh.innerHTML = "NOK";
thigh.style = "background-color: #f06060";
}
historicalPush(data.MbarFloat);
ping.innerHTML = Date.now();
});