Add temperature and humidity stuff

This commit is contained in:
hmelder 2024-11-10 01:22:18 +01:00 committed by Rahix
parent 52231a9e9c
commit 4edabc5c56
4 changed files with 57 additions and 1 deletions

View file

@ -62,6 +62,17 @@ type apiData struct {
// DPOn means the diffusion pump is turned on. // DPOn means the diffusion pump is turned on.
DPOn bool DPOn bool
} }
// Temperature state.
Temperatures struct {
DPBottom float32
DPTop float32
DPInlet float32
SEM float32
}
// Humidity state.
Humidity struct {
SEM float32
}
// Pressure feedback into evacuation board. // Pressure feedback into evacuation board.
Feedback struct { Feedback struct {
// RoughReached is true when the system has reached a rough vacuum // RoughReached is true when the system has reached a rough vacuum
@ -115,6 +126,11 @@ func (s *webServer) apiData(skipSystem bool) *apiData {
ad.Pirani.MbarFloat = mbar ad.Pirani.MbarFloat = mbar
ad.Pumps.RPOn = state.rpOn ad.Pumps.RPOn = state.rpOn
ad.Pumps.DPOn = state.dpOn ad.Pumps.DPOn = state.dpOn
ad.Temperatures.DPBottom = state.tempDPBottom
ad.Temperatures.DPTop = state.tempDPTop
ad.Temperatures.DPInlet = state.tempDPInlet
ad.Temperatures.SEM = state.tempSEM
ad.Humidity.SEM = state.humiditySEM
ad.Feedback.RoughReached = rough ad.Feedback.RoughReached = rough
ad.Feedback.HighReached = high ad.Feedback.HighReached = high
ad.LoopLoad = s.d.loopLoad() ad.LoopLoad = s.d.loopLoad()

View file

@ -111,6 +111,22 @@ td > span {
<th>DP</th> <th>DP</th>
<td id="dp">{{ if .Pumps.DPOn }}ON{{ else }}OFF{{ end }}</td> <td id="dp">{{ if .Pumps.DPOn }}ON{{ else }}OFF{{ end }}</td>
</tr> </tr>
<tr>
<th>Temperatures</th>
<th>SEM</th>
<td id="temp-sem">{{ .Temperatures.SEM }}</td>
<th>DPBottom</th>
<td id="temp-dp-bottom">{{ .Temperatures.DPBottom }}</td>
<th>DPTop</th>
<td id="temp-dp-top">{{ .Temperatures.DPTop }}</td>
<th>DPInlet</th>
<td id="temp-dp-inlet">{{ .Temperatures.DPInlet }}</td>
</tr>
<tr>
<th>Humidity</th>
<th>SEM</th>
<td id="humidity-sem">{{ .Humidity.SEM }}</td>
</tr>
<tr> <tr>
<th>Safety</th> <th>Safety</th>
<th style="font-size: 0.7em;">Pirani<br />Failsafe</th> <th style="font-size: 0.7em;">Pirani<br />Failsafe</th>
@ -316,6 +332,11 @@ window.addEventListener("load", (_) => {
let trough = document.querySelector("#trough"); let trough = document.querySelector("#trough");
let thigh = document.querySelector("#thigh"); let thigh = document.querySelector("#thigh");
let load = document.querySelector("#load"); let load = document.querySelector("#load");
let tempSEM = document.querySelector("#temp-sem");
let tempDPBottom = document.querySelector("#temp-dp-bottom");
let tempDPTop = document.querySelector("#temp-dp-top");
let tempDPInlet = document.querySelector("#temp-dp-inlet");
let humiditySEM = document.querySelector('#humidity-sem');
// Buttons // Buttons
let pd = document.querySelector("#pd"); let pd = document.querySelector("#pd");
@ -388,6 +409,12 @@ window.addEventListener("load", (_) => {
dp.style = colors.default; dp.style = colors.default;
} }
tempSEM.innerHTML = data.Temperatures.SEM + "&nbsp;°C";
tempDPBottom.innerHTML = data.Temperatures.DPBottom + "&nbsp;°C";
tempDPTop.innerHTML = data.Temperatures.DPTop + "&nbsp;°C";
tempDPInlet.innerHTML = data.Temperatures.DPInlet + "&nbsp;°C";
humiditySEM.innerHTML = data.Humidity.SEM + "&nbsp;%";
let t = []; let t = [];
if (data.Feedback.RoughReached) { if (data.Feedback.RoughReached) {
trough.innerHTML = "OK"; trough.innerHTML = "OK";
@ -413,7 +440,7 @@ window.addEventListener("load", (_) => {
// Indicate all process values as unknown // Indicate all process values as unknown
[failsafe, highpressure, rp, dp, trough, thigh, volts, mbar].forEach((el) => { [failsafe, highpressure, rp, dp, trough, thigh, volts, mbar, tempDPBottom, tempDPTop, tempDPInlet].forEach((el) => {
if (!el.innerHTML.includes("??")) { if (!el.innerHTML.includes("??")) {
el.innerHTML += "??"; el.innerHTML += "??";
} }

View file

@ -35,6 +35,12 @@ func main() {
d.daemonState.piraniVolts3.limit = 3 d.daemonState.piraniVolts3.limit = 3
d.daemonState.piraniVolts100.limit = 100 d.daemonState.piraniVolts100.limit = 100
d.tempDPBottom = 420.6
d.tempDPTop = 69.0
d.tempDPInlet = 42.0
d.tempSEM = 42.5
d.humiditySEM = 66.6
d.aboveRough.threshold = float64(flagPressureThresholdRough) d.aboveRough.threshold = float64(flagPressureThresholdRough)
d.aboveRough.hysteresis = float64(flagPressureThresholdRoughHysteresis) d.aboveRough.hysteresis = float64(flagPressureThresholdRoughHysteresis)
d.aboveHigh.threshold = float64(flagPressureThresholdHigh) d.aboveHigh.threshold = float64(flagPressureThresholdHigh)

View file

@ -55,6 +55,13 @@ type daemonState struct {
pumpdown momentaryOutput pumpdown momentaryOutput
aboveRough thresholdOutput aboveRough thresholdOutput
aboveHigh thresholdOutput aboveHigh thresholdOutput
tempDPBottom float32
tempDPTop float32
tempDPInlet float32
tempSEM float32
humiditySEM float32
} }
func (d *daemonState) vacuumStatus() (rough, high bool) { func (d *daemonState) vacuumStatus() (rough, high bool) {