diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index 8bdd46065..438946eaa 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("3.9.3066.1")] -[assembly: AssemblyFileVersion("3.9.3066.1")] +[assembly: AssemblyVersion("3.9.3067.1")] +[assembly: AssemblyFileVersion("3.9.3067.1")] diff --git a/TBF/Rig/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs b/TBF/Rig/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs index 9fe5b1d29..502c11afd 100644 --- a/TBF/Rig/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs +++ b/TBF/Rig/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs @@ -46,9 +46,12 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead public const string OptoDataDirectory = "C:\\TBF\\ProcessData"; public const int StartOptoDataCount = OptoDataBufferSize / 2; public const int EndOptoDataCount = OptoDataBufferSize - StartOptoDataCount; - public const int StartEndFilterSamplesCount2 = 2; //20 /// StartEndFilterSamplesCount = 2 * StartEndFilterSamplesCount2 + 1 + public const int StartEndFilterSamplesCount2 = 1; //20 /// StartEndFilterSamplesCount = 2 * StartEndFilterSamplesCount2 + 1 public const int FeatureVectorSize = 9; + private const int StartSampleDelaySec = 5; + private const int EndSampleDelayCount = 2; + private OptoHeadTest _optoHeadTest; public OptoHeadTest OptoHeadTest @@ -385,9 +388,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead /// public int TestStartTelegramIx; public int TestEndTelegramIx; - int endTelegramIdx1; - int endTelegramIdx2; - int endTelegramIdx3; + readonly int[] endTelegramIdx = new int[EndSampleDelayCount]; int currentTelegramIx; bool startSampleAcquired; @@ -670,19 +671,21 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead timeFromStart += StateMachine.Period; ReadPulses(); - if (!startSampleAcquired && (timeFromStart >= 8) && (currentTelegramIx >= 0)) + if (!startSampleAcquired && (timeFromStart >= StartSampleDelaySec) && (currentTelegramIx >= 0)) { - /// Take the test start sample startSampleAcquired = true; TestStartTelegramIx = currentTelegramIx; } else if (startSampleAcquired) { - /// Shift data in pipelines - TestEndTelegramIx = endTelegramIdx3; - endTelegramIdx3 = endTelegramIdx2; - endTelegramIdx2 = endTelegramIdx1; - endTelegramIdx1 = currentTelegramIx; + TestEndTelegramIx = endTelegramIdx[EndSampleDelayCount - 1]; + + for (int i = EndSampleDelayCount - 1; i > 0; i--) + { + endTelegramIdx[i] = endTelegramIdx[i - 1]; + } + + endTelegramIdx[0] = currentTelegramIx; } } @@ -983,9 +986,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead currentTelegramIx = -1; startSampleAcquired = false; TestStartTelegramIx = 0; - endTelegramIdx1 = 0; - endTelegramIdx2 = 0; - endTelegramIdx3 = 0; + for (int i = 0; i < endTelegramIdx.Length; i++) + { + endTelegramIdx[i] = 0; + } TestEndTelegramIx = 0; if (optoSerialPort != null && optoSerialPort.IsOpen) optoSerialPort.DiscardInBuffer();