diff --git a/succbone/succd/process.go b/succbone/succd/process.go index b38cf25..a25aa26 100644 --- a/succbone/succd/process.go +++ b/succbone/succd/process.go @@ -17,6 +17,8 @@ type daemon struct { // Pirani gauge. adcPirani adc + failsafe bool + gpioDiffusionPump gpio gpioRoughingPump gpio gpioBtnPumpDown gpio @@ -120,6 +122,24 @@ func (d *daemon) processOnce(_ context.Context) error { d.aboveRough.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. for _, rel := range []struct { name string