diff --git a/succbone/succbone-din-mount.FCStd b/succbone/succbone-din-mount.FCStd index 8deed3d..78adc9b 100644 --- a/succbone/succbone-din-mount.FCStd +++ b/succbone/succbone-din-mount.FCStd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a7f941794ce7b2b521fc5a38d28bc91f028b66e155b0446b5b6fa73d57ae922c -size 888650 +oid sha256:152cca5f14439f176994a97ab70fbf3eceed8fec340a59be8776ba1670043f3c +size 1024525 diff --git a/succbone/succbone-din-mount.stl b/succbone/succbone-din-mount.stl new file mode 100644 index 0000000..e7a2796 --- /dev/null +++ b/succbone/succbone-din-mount.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd72552b5685c0a42bf28f89a51ae0eb95d2f0a26644b1839d7f89614d462f7f +size 2102184 diff --git a/succbone/succd/go.mod b/succbone/succd/go.mod index 574985d..d35e107 100644 --- a/succbone/succd/go.mod +++ b/succbone/succd/go.mod @@ -4,5 +4,8 @@ go 1.22.3 require ( github.com/coder/websocket v1.8.12 + github.com/simonvetter/modbus v1.6.3 k8s.io/klog v1.0.0 ) + +require github.com/goburrow/serial v0.1.0 // indirect diff --git a/succbone/succd/go.sum b/succbone/succd/go.sum index c8b5195..ab9ca54 100644 --- a/succbone/succd/go.sum +++ b/succbone/succd/go.sum @@ -1,5 +1,9 @@ github.com/coder/websocket v1.8.12 h1:5bUXkEPPIbewrnkU8LTCLVaxi4N4J8ahufH2vlo4NAo= github.com/coder/websocket v1.8.12/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= +github.com/goburrow/serial v0.1.0 h1:v2T1SQa/dlUqQiYIT8+Cu7YolfqAi3K96UmhwYyuSrA= +github.com/goburrow/serial v0.1.0/go.mod h1:sAiqG0nRVswsm1C97xsttiYCzSLBmUZ/VSlVLZJ8haA= +github.com/simonvetter/modbus v1.6.3 h1:kDzwVfIPczsM4Iz09il/Dij/bqlT4XiJVa0GYaOVA9w= +github.com/simonvetter/modbus v1.6.3/go.mod h1:hh90ZaTaPLcK2REj6/fpTbiV0J6S7GWmd8q+GVRObPw= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= diff --git a/succbone/succd/http.go b/succbone/succd/http.go index 4365428..9a43281 100644 --- a/succbone/succd/http.go +++ b/succbone/succd/http.go @@ -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() @@ -163,16 +179,60 @@ func (s *webServer) viewStream(w http.ResponseWriter, r *http.Request) { } } +func boolToFloat(b bool) float32 { + if b { + return 1.0 + } else { + return 0.0 + } +} + // httpMetrics serves minimalistic Prometheus-compatible metrics. func (s *webServer) viewMetrics(w http.ResponseWriter, r *http.Request) { // TODO(q3k): also serve Go stuff using the actual Prometheus metrics client // library. // TODO(q3k): serve the rest of the data model state := s.d.snapshot() - mbar := state.piraniMbar100.mbar + + // sem_pressure_mbar is meant to represent the fused pressure value + // from all data sources once we have more vacuum sensors in the + // system. sem_pirani_mbar is just the reading from the pirani gauge. fmt.Fprintf(w, "# HELP sem_pressure_mbar Pressure in the SEM chamber, in millibar\n") fmt.Fprintf(w, "# TYPE sem_pressure_mbar gauge\n") - fmt.Fprintf(w, "sem_pressure_mbar %f\n", mbar) + fmt.Fprintf(w, "sem_pressure_mbar %f\n", state.piraniMbar100.mbar) + + fmt.Fprintf(w, "# HELP sem_pirani_mbar Pressure reading by the Pirani gauge, in millibar\n") + fmt.Fprintf(w, "# TYPE sem_pirani_mbar gauge\n") + fmt.Fprintf(w, "sem_pirani_mbar %f\n", state.piraniMbar100.mbar) + + fmt.Fprintf(w, "# HELP sem_pirani_volts Voltage output from the Pirani gauge, in volts\n") + fmt.Fprintf(w, "# TYPE sem_pirani_volts gauge\n") + fmt.Fprintf(w, "sem_pirani_volts %f\n", state.piraniVolts100.avg) + + fmt.Fprintf(w, "# HELP sem_pirani_failsafe_active Whether pirani gauge failsafe mode is active (boolean)\n") + fmt.Fprintf(w, "# TYPE sem_pirani_failsafe_active gauge\n") + fmt.Fprintf(w, "sem_pirani_failsafe_active %f\n", boolToFloat(state.safety.failsafe)) + + fmt.Fprintf(w, "# HELP sem_dp_lockout_active Whether diffusion pump lockout is active (boolean)\n") + fmt.Fprintf(w, "# TYPE sem_dp_lockout_active gauge\n") + fmt.Fprintf(w, "sem_dp_lockout_active %f\n", boolToFloat(state.safety.highPressure)) + + fmt.Fprintf(w, "# HELP sem_pump_diffusion_running Whether the diffusion pump is running (boolean)\n") + fmt.Fprintf(w, "# TYPE sem_pump_diffusion_running gauge\n") + fmt.Fprintf(w, "sem_pump_diffusion_running %f\n", boolToFloat(state.dpOn)) + + fmt.Fprintf(w, "# HELP sem_pump_roughing_running Whether the roughing pump is running (boolean)\n") + fmt.Fprintf(w, "# TYPE sem_pump_roughing_running gauge\n") + fmt.Fprintf(w, "sem_pump_roughing_running %f\n", boolToFloat(state.rpOn)) + + rough, high := state.vacuumStatus() + fmt.Fprintf(w, "# HELP sem_vacuum_rough_reached Whether a rough vacuum has been reached (boolean)\n") + fmt.Fprintf(w, "# TYPE sem_vacuum_rough_reached gauge\n") + fmt.Fprintf(w, "sem_vacuum_rough_reached %f\n", boolToFloat(rough)) + + fmt.Fprintf(w, "# HELP sem_vacuum_high_reached Whether a high vacuum has been reached (boolean)\n") + fmt.Fprintf(w, "# TYPE sem_vacuum_high_reached gauge\n") + fmt.Fprintf(w, "sem_vacuum_high_reached %f\n", boolToFloat(high)) } func (s *webServer) viewRoughingPumpEnable(w http.ResponseWriter, r *http.Request) { diff --git a/succbone/succd/index.html b/succbone/succd/index.html index abd5695..def9ac9 100644 --- a/succbone/succd/index.html +++ b/succbone/succd/index.html @@ -9,19 +9,19 @@ body { padding: 2em; } table { - font-size: 40px; + font-size: 30px; } table.status td { width: 2em; } th, td { background-color: #e8e8e8; - padding: 0.4em; + padding: 0.3em; } th { font-weight: 100; text-align: right; - font-size: 30px; + font-size: 25px; } td { text-align: left; @@ -34,7 +34,7 @@ h2 { font-weight: 100; } button { - height: 4.5em; + height: 3.3em; padding-left: 1.5em; padding-right: 1.5em; } @@ -76,6 +76,7 @@ td > span { .has-hidden:hover .hidden-text { display: block; +} @media only screen and (max-width: 700px) { body { @@ -120,19 +121,6 @@ td > span { -
Pirani Pressure | -
- {{ .Pirani.Mbar }}
-
- Voltage: {{ .Pirani.Volts }}
-
- |
-
---|
Control | @@ -163,6 +151,41 @@ td > span {
---|
Pirani Pressure | +
+ {{ .Pirani.Mbar }}
+
+ Voltage: {{ .Pirani.Volts }}
+
+ |
+ |
---|---|---|
Temperatures | +DP Bottom | +{{ .Temperatures.DPBottom }} | +
DP Top | +{{ .Temperatures.DPTop }} | +|
DP Inlet | +{{ .Temperatures.DPInlet }} | +|
SEM Environment | +{{ .Temperatures.SEM }} | +|
Humidity | +SEM Environment | +{{ .Humidity.SEM }} | +