diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs index d70a2fa28..83f099ba5 100644 --- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs +++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs @@ -313,10 +313,21 @@ namespace TBF.BenchControl.Sequences StateMachine.ControlBoard.ManualUIAllowed = !StateMachine.Procedure.ManualCtrlDisabled; Bridge.Bench2UI(ButtonsEtc.StopBtnEn); /// Enable STOP button - + int newBatchNr = Program.LocalSettings.BatchNr; log.FatalFormat("New measurement session started: batch = {0}, procedure = {1}", newBatchNr, StateMachine.Procedure.Name); + /// + /// Clear iperlhead data (including PCB Number, avoid double use) + /// + foreach (var cmpnt in StateMachine.Components) + { + if (cmpnt is TestMethods.iPerlCommunication.iPerlHead.IperlHead) + { + (cmpnt as TestMethods.iPerlCommunication.iPerlHead.IperlHead).ClearData(); + } + } + if (selection == Selection.RestoreBatch) { BatchRslts = CreateNewBatchResults(newBatchNr, StateMachine.Procedure); diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs index c4cc7c791..e01cbab8e 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs @@ -680,7 +680,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); -#if TURA_IPERL || TURA_SPECIAL +#if TEST_MODE if (!BatchRslts.IsProduction() && ((test.Name.ToLower().Contains("q2") && Math.Abs(meterRslt.Error) > 2.0 && Math.Abs(meterRslt.Error) <= 4.0) || (test.Name.ToLower().Contains("q1") && Math.Abs(meterRslt.Error) > 5.0 && Math.Abs(meterRslt.Error) <= 10.0))) diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs index be8c0fe7e..85556ff2e 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs @@ -1018,7 +1018,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); -#if TURA_IPERL || TURA_SPECIAL +#if TEST_MODE if (!BatchRslts.IsProduction() && ((test.Name.ToLower().Contains("q2") && Math.Abs(meterRslt.Error) > 2.0 && Math.Abs(meterRslt.Error) <= 4.0) || (test.Name.ToLower().Contains("q1") && Math.Abs(meterRslt.Error) > 5.0 && Math.Abs(meterRslt.Error) <= 10.0))) @@ -1043,7 +1043,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection } #endif - meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) + meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); meterRslt.TestDone = true; diff --git a/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs b/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs index 486bcf481..3b91d0b6e 100644 --- a/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs +++ b/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs @@ -802,7 +802,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication { /// /// The activity is "Read configuration" (this enables the watermeter, resets error flag) - /// or "Read configuration if enabled" (this keeps th error flag). + /// or "Read configuration if enabled" (this keeps the error flag). /// if (!multiTestParams[currentActivityStep].Activity.ToLower().Contains(" if enabled")) { @@ -811,6 +811,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication if (ihead.CommFailed) return CommErr.CommFailed; + ihead.ConfigStruct = null; /// Clear previous ConfigStruct, avoid reuse of (not anymore valid) PCB Number + if (OpenPort(threadId, ihead) != 0) return CommErr.OpenPort; /// Open RFID port CommErr error = CommErr.Read; @@ -847,7 +849,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication /// true on success static CommErr SetTestMode(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr) { - if (ihead.CommFailed) return CommErr.CommFailed; + if (ihead.CommFailed || ihead.ConfigStruct == null) return CommErr.CommFailed; Byte testModeConfig = 0xA0; /// Default value /// diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index 17a61d2e7..2a2a5fcd1 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.17.752.0")] -[assembly: AssemblyFileVersion("2.17.752.0")] +[assembly: AssemblyVersion("2.17.753.0")] +[assembly: AssemblyFileVersion("2.17.753.0")]