diff --git a/TestBenchFramework/BenchControl/Elde/Valve/SetValvesOp.cs b/TestBenchFramework/BenchControl/Elde/Valve/SetValvesOp.cs index 4650e32cb..7f2fa187d 100644 --- a/TestBenchFramework/BenchControl/Elde/Valve/SetValvesOp.cs +++ b/TestBenchFramework/BenchControl/Elde/Valve/SetValvesOp.cs @@ -33,8 +33,8 @@ namespace TBF.BenchControl.Elde.Valve get { int max = 0; - foreach (var vlv in VOpen) if (vlv.Delay > max) max = vlv.Delay; - foreach (var vlv in VClose) if (vlv.Delay > max) max = vlv.Delay; + foreach (var vlv in VOpen) if ((vlv != null) && (vlv.Delay > max)) max = vlv.Delay; + foreach (var vlv in VClose) if ((vlv != null) && (vlv.Delay > max)) max = vlv.Delay; return max; } } diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs index 63b1a69c1..683886ea3 100644 --- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs +++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs @@ -497,9 +497,9 @@ namespace TBF.BenchControl.Sequences ButtonsEtc.SensitivityTestBtnEn | ((Cameras.Count > 0) ? ButtonsEtc.CalibrationBtnEn : 0) | ButtonsEtc.TryOpticalHeadsBtnEn)) | - (((StateMachine.Balance1 != null) && !emptying1) ? ButtonsEtc.EmptyTankBtn1En : 0) | - (((StateMachine.Balance2 != null) && !emptying2) ? ButtonsEtc.EmptyTankBtn2En : 0) | - (((StateMachine.Balance3 != null) && !emptying3) ? ButtonsEtc.EmptyTankBtn3En : 0)); + (((StateMachine.Balance1 != null) && (StateMachine.EmptyTankValve1 != null) && !emptying1) ? ButtonsEtc.EmptyTankBtn1En : 0) | + (((StateMachine.Balance2 != null) && (StateMachine.EmptyTankValve2 != null) && !emptying2) ? ButtonsEtc.EmptyTankBtn2En : 0) | + (((StateMachine.Balance3 != null) && (StateMachine.EmptyTankValve3 != null) && !emptying3) ? ButtonsEtc.EmptyTankBtn3En : 0)); selection = Selection.None; State.Create("MainSeq : Select an activity") diff --git a/TestBenchFramework/BenchControl/StateMachine.cs b/TestBenchFramework/BenchControl/StateMachine.cs index b119c40c0..99d2a7b2e 100644 --- a/TestBenchFramework/BenchControl/StateMachine.cs +++ b/TestBenchFramework/BenchControl/StateMachine.cs @@ -282,20 +282,17 @@ namespace TBF.BenchControl // Automatic detection of empty tank valves foreach (var opath in outputPaths) { - if ((Balance1 != null) && (opath.Balance == Balance1.Cfg.Name)) + if ((EmptyTankValve1 == null) && (Balance1 != null) && (opath.Balance == Balance1.Cfg.Name)) { EmptyTankValve1 = TbfComponents.FindComponent(opath.EmptyTankValve) as IValve; - break; } - if ((Balance2 != null) && (opath.Balance == Balance2.Cfg.Name)) + if ((EmptyTankValve2 == null) && (Balance2 != null) && (opath.Balance == Balance2.Cfg.Name)) { EmptyTankValve2 = TbfComponents.FindComponent(opath.EmptyTankValve) as IValve; - break; } - if ((Balance3 != null) && (opath.Balance == Balance3.Cfg.Name)) + if ((EmptyTankValve3 == null) && (Balance3 != null) && (opath.Balance == Balance3.Cfg.Name)) { EmptyTankValve3 = TbfComponents.FindComponent(opath.EmptyTankValve) as IValve; - break; } }