succd: early refuse unsafe operations
This commit is contained in:
parent
960be9cd23
commit
dda098f634
|
@ -106,21 +106,21 @@ func (d *daemon) processOnce(_ context.Context) error {
|
||||||
// Unrealistic result, Pirani probe probably disconnected. Failsafe mode.
|
// Unrealistic result, Pirani probe probably disconnected. Failsafe mode.
|
||||||
if !d.safety.failsafe {
|
if !d.safety.failsafe {
|
||||||
d.safety.failsafe = true
|
d.safety.failsafe = true
|
||||||
klog.Errorf("Pirani probe seems disconnected; enabling failsafe mode")
|
klog.Errorf("SAFETY: Pirani probe seems disconnected; enabling failsafe mode")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if d.safety.failsafe && mbar > 1e2 {
|
if d.safety.failsafe && mbar > 1e2 {
|
||||||
d.safety.failsafe = false
|
d.safety.failsafe = false
|
||||||
klog.Infof("Pirani probe value (%s) is plausible again; quitting failsafe mode", formatMbar(mbar))
|
klog.Infof("SAFETY: Pirani probe value (%s) is plausible again; quitting failsafe mode", formatMbar(mbar))
|
||||||
}
|
}
|
||||||
|
|
||||||
if !d.safety.highPressure && mbar >= 1e-1 {
|
if !d.safety.highPressure && mbar >= 1e-1 {
|
||||||
d.safety.highPressure = true
|
d.safety.highPressure = true
|
||||||
klog.Warningf("Pressure is too high (%s mbar); enabling diffusion pump lockout", formatMbar(mbar))
|
klog.Warningf("SAFETY: Pressure is too high (%s mbar); enabling diffusion pump lockout", formatMbar(mbar))
|
||||||
}
|
}
|
||||||
if d.safety.highPressure && mbar < (1e-1)-(1e-2) {
|
if d.safety.highPressure && mbar < (1e-1)-(1e-2) {
|
||||||
d.safety.highPressure = false
|
d.safety.highPressure = false
|
||||||
klog.Infof("Pressure is low enough (%s mbar) for diffusion pump operation; quitting diffusion pump lockout", formatMbar(mbar))
|
klog.Infof("SAFETY: Pressure is low enough (%s mbar) for diffusion pump operation; quitting diffusion pump lockout", formatMbar(mbar))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
d.safety.failsafe = true
|
d.safety.failsafe = true
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
import "k8s.io/klog"
|
||||||
|
|
||||||
// daemonController is the control/data interface passed on to external system
|
// daemonController is the control/data interface passed on to external system
|
||||||
// controllers, eg. the web interface.
|
// controllers, eg. the web interface.
|
||||||
//
|
//
|
||||||
|
@ -27,12 +29,20 @@ func (d *daemon) snapshot() *daemonState {
|
||||||
func (d *daemon) rpSet(state bool) {
|
func (d *daemon) rpSet(state bool) {
|
||||||
d.mu.Lock()
|
d.mu.Lock()
|
||||||
defer d.mu.Unlock()
|
defer d.mu.Unlock()
|
||||||
|
if !state && d.dpOn {
|
||||||
|
klog.Errorf("SAFETY: Refusing to disable roughing pump while diffusion pump is active")
|
||||||
|
return
|
||||||
|
}
|
||||||
d.rpOn = state
|
d.rpOn = state
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *daemon) dpSet(state bool) {
|
func (d *daemon) dpSet(state bool) {
|
||||||
d.mu.Lock()
|
d.mu.Lock()
|
||||||
defer d.mu.Unlock()
|
defer d.mu.Unlock()
|
||||||
|
if state && (d.safety.failsafe || d.safety.highPressure) {
|
||||||
|
klog.Errorf("SAFETY: Refusing to enable diffusion pump with safety alerts present")
|
||||||
|
return
|
||||||
|
}
|
||||||
d.dpOn = state
|
d.dpOn = state
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue