Fixed a bug in emptying valves initialization on StateMachine startup

This commit is contained in:
Milan Hanajik 2014-09-06 11:35:10 +02:00
parent ef8284586e
commit a6f5b287c9
3 changed files with 8 additions and 11 deletions

View File

@ -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;
}
}

View File

@ -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")

View File

@ -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;
}
}