Temperature Measurement & MODBUS Integration #17

Merged
rahix merged 13 commits from more-temps into main 2024-11-10 06:58:09 +00:00
4 changed files with 57 additions and 1 deletions
Showing only changes of commit 4edabc5c56 - Show all commits

View file

@ -62,6 +62,17 @@ type apiData struct {
// DPOn means the diffusion pump is turned on.
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.
Feedback struct {
// 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.Pumps.RPOn = state.rpOn
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.HighReached = high
ad.LoopLoad = s.d.loopLoad()

View file

@ -111,6 +111,22 @@ td > span {
<th>DP</th>
<td id="dp">{{ if .Pumps.DPOn }}ON{{ else }}OFF{{ end }}</td>
</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>
<th>Safety</th>
<th style="font-size: 0.7em;">Pirani<br />Failsafe</th>
@ -316,6 +332,11 @@ window.addEventListener("load", (_) => {
let trough = document.querySelector("#trough");
let thigh = document.querySelector("#thigh");
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
let pd = document.querySelector("#pd");
@ -388,6 +409,12 @@ window.addEventListener("load", (_) => {
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 = [];
if (data.Feedback.RoughReached) {
trough.innerHTML = "OK";
@ -413,7 +440,7 @@ window.addEventListener("load", (_) => {
// 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("??")) {
el.innerHTML += "??";
}

View file

@ -35,6 +35,12 @@ func main() {
d.daemonState.piraniVolts3.limit = 3
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.hysteresis = float64(flagPressureThresholdRoughHysteresis)
d.aboveHigh.threshold = float64(flagPressureThresholdHigh)

View file

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