succd: add pirani failsafe
This commit is contained in:
parent
6d97eb62a8
commit
34ab508b13
|
@ -17,6 +17,8 @@ type daemon struct {
|
||||||
// Pirani gauge.
|
// Pirani gauge.
|
||||||
adcPirani adc
|
adcPirani adc
|
||||||
|
|
||||||
|
failsafe bool
|
||||||
|
|
||||||
gpioDiffusionPump gpio
|
gpioDiffusionPump gpio
|
||||||
gpioRoughingPump gpio
|
gpioRoughingPump gpio
|
||||||
gpioBtnPumpDown gpio
|
gpioBtnPumpDown gpio
|
||||||
|
@ -120,6 +122,24 @@ func (d *daemon) processOnce(_ context.Context) error {
|
||||||
d.aboveRough.process(float64(mbar))
|
d.aboveRough.process(float64(mbar))
|
||||||
d.aboveHigh.process(float64(mbar))
|
d.aboveHigh.process(float64(mbar))
|
||||||
|
|
||||||
|
if mbar < 4e-6 {
|
||||||
|
// Unrealistic result, Pirani probe probably disconnected. Failsafe mode.
|
||||||
|
if !d.failsafe {
|
||||||
|
d.failsafe = true
|
||||||
|
klog.Errorf("Pirani probe seems disconnected; enabling failsafe mode")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if d.failsafe {
|
||||||
|
d.failsafe = false
|
||||||
|
klog.Infof("Pirani probe has been reconnected; quitting failsafe mode")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if d.failsafe {
|
||||||
|
d.aboveRough.output = true
|
||||||
|
d.aboveHigh.output = true
|
||||||
|
}
|
||||||
|
|
||||||
// Update relay outputs.
|
// Update relay outputs.
|
||||||
for _, rel := range []struct {
|
for _, rel := range []struct {
|
||||||
name string
|
name string
|
||||||
|
|
Loading…
Reference in a new issue