diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs index 35e417e38..380a29974 100644 --- a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs +++ b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs @@ -241,7 +241,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication const string WriteQ2CorrectionStr = "Write Q2 correction"; const string WriteQ2CorrectionAltStr = "Write Q2 correction Alt"; const string WriteQ2CorrectionGreeceStr = "Write Q2 correction Greece"; - const string Reset2HzCorrectionStr = "Reset 2Hz correction"; + const string WriteQ2CorrectionRLStr = "Write Q2 correction R-L"; + const string WriteQ2CorrectionLRStr = "Write Q2 correction L-R"; + const string Reset2HzCorrectionStr = "Reset 2Hz correction"; const string Write2HzCorrectionStr = "Write 2Hz correction"; @@ -737,7 +739,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication else if (activity.ToLower().Equals(WriteQ2CorrectionStr.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, ref resultStr, Q2CorrType.Standard, null, false); else if (activity.ToLower().Equals(WriteQ2CorrectionAltStr.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, ref resultStr, Q2CorrType.Dewa, null, false); else if (activity.ToLower().Contains(WriteQ2CorrectionGreeceStr.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, ref resultStr, Q2CorrType.Greece, activity.Substring(WriteQ2CorrectionGreeceStr.Length).Trim(), true); - else if (activity.ToLower().Equals(Reset2HzCorrectionStr.ToLower())) error = Reset2HzCorrection(threadID, ihead, wm, ref resultStr); + else if (activity.ToLower().Contains(WriteQ2CorrectionRLStr.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, ref resultStr, Q2CorrType.RL, activity.Substring(WriteQ2CorrectionRLStr.Length).Trim(), true); + else if (activity.ToLower().Contains(WriteQ2CorrectionLRStr.ToLower())) error = WriteQ2Correction(threadID, ihead, wm, ref resultStr, Q2CorrType.LR, activity.Substring(WriteQ2CorrectionLRStr.Length).Trim(), true); + else if (activity.ToLower().Equals(Reset2HzCorrectionStr.ToLower())) error = Reset2HzCorrection(threadID, ihead, wm, ref resultStr); else if (activity.ToLower().Equals(Write2HzCorrectionStr.ToLower())) error = Write2HzCorrection(threadID, ihead, wm, ref resultStr); else { @@ -1524,21 +1528,58 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication q2CorrRFlow = (byte)((int)Math.Round(q2Correction) & 0x000000FF); q2CorrLFlow = (byte)((int)Math.Round(q2Correction) & 0x000000FF); } + else if (q2CorrType == Q2CorrType.RL) + { + q2CorrRFlow = (byte)((int)Math.Round(q2Correction) & 0x000000FF); + } + else if (q2CorrType == Q2CorrType.LR) + { + q2CorrLFlow = (byte)((int)Math.Round(q2Correction) & 0x000000FF); + } if (OpenPort(threadId, ihead) != 0) return CommErr.OpenPort; /// Open RFID port CommErr error = CommErr.Write; - byte[] wrData = new byte[2] { q2CorrRFlow, q2CorrLFlow }; - /// - for (int j = 0; j < cfg.MaxCommRetries; j++) - { - if (0 == WriteRequestPort(threadId, ihead, MessageID.MetrologyMemory, Q2CorrFactorsAddr, wrData.Length, wrData, cfg.CommTimeout)) - { - error = CommErr.None; - break; - } - } + if (q2CorrType == Q2CorrType.RL) + { + /// Write R->L Q2 correction factor only + byte[] wrData = new byte[1] { q2CorrRFlow }; + for (int j = 0; j < cfg.MaxCommRetries; j++) + { + if (0 == WriteRequestPort(threadId, ihead, MessageID.MetrologyMemory, Q2CorrFactorsAddr, wrData.Length, wrData, cfg.CommTimeout)) + { + error = CommErr.None; + break; + } + } + } + else if (q2CorrType == Q2CorrType.LR) + { + /// Write L->R Q2 correction factor only + byte[] wrData = new byte[1] { q2CorrLFlow }; + for (int j = 0; j < cfg.MaxCommRetries; j++) + { + if (0 == WriteRequestPort(threadId, ihead, MessageID.MetrologyMemory, Q2CorrFactorsAddr + 1, wrData.Length, wrData, cfg.CommTimeout)) + { + error = CommErr.None; + break; + } + } + } + else + { + /// Write both Q2 correction factors + byte[] wrData = new byte[2] { q2CorrRFlow, q2CorrLFlow }; + for (int j = 0; j < cfg.MaxCommRetries; j++) + { + if (0 == WriteRequestPort(threadId, ihead, MessageID.MetrologyMemory, Q2CorrFactorsAddr, wrData.Length, wrData, cfg.CommTimeout)) + { + error = CommErr.None; + break; + } + } + } /// /// Verification disabled on 16.02.2016 @@ -1560,39 +1601,52 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication rfidDataLogger.Warn(ihead.Name + ": " + resultStr); ihead.Q2CorrectionDone = true; ihead.Q2Correction = q2Correction; - ihead.Q2CorrRFlow = (int)(sbyte)q2CorrRFlow; - ihead.Q2CorrLFlow = (int)(sbyte)q2CorrLFlow; - #if IPERL + if (q2CorrType != Q2CorrType.LR) ihead.Q2CorrRFlow = (int)(sbyte)q2CorrRFlow; + if (q2CorrType != Q2CorrType.RL) ihead.Q2CorrLFlow = (int)(sbyte)q2CorrLFlow; +#if IPERL if (wm != null) { wm.Q2ErrWOCorrection = ihead.Q2ErrorWOCorrection; wm.Q2CorrectionDone = ihead.Q2CorrectionDone; wm.Q2Correction = ihead.Q2Correction; - wm.Q2CorrRFlow = ihead.Q2CorrRFlow; - wm.Q2CorrLFlow = ihead.Q2CorrLFlow; + if (q2CorrType != Q2CorrType.LR) wm.Q2CorrRFlow = ihead.Q2CorrRFlow; + if (q2CorrType != Q2CorrType.RL) wm.Q2CorrLFlow = ihead.Q2CorrLFlow; } - #endif +#endif break; } } } #else - if (error == CommErr.None) + + if (error == CommErr.None) { - resultStr = string.Format("Q2 correction: R-flow={0}, L-flow={1}", (SByte)q2CorrRFlow, (SByte)q2CorrLFlow); + if (q2CorrType == Q2CorrType.RL) + { + resultStr = string.Format("Q2 correction: R-flow={0}", (SByte)q2CorrRFlow); + } + else if (q2CorrType == Q2CorrType.LR) + { + resultStr = string.Format("Q2 correction: L-flow={0}", (SByte)q2CorrLFlow); + } + else + { + resultStr = string.Format("Q2 correction: R-flow={0}, L-flow={1}", (SByte)q2CorrRFlow, (SByte)q2CorrLFlow); + } + rfidDataLogger.Warn(ihead.Name + ": " + resultStr); ihead.Q2CorrectionDone = true; ihead.Q2Correction = q2Correction; - ihead.Q2CorrRFlow = (int)(sbyte)q2CorrRFlow; - ihead.Q2CorrLFlow = (int)(sbyte)q2CorrLFlow; + if (q2CorrType != Q2CorrType.LR) ihead.Q2CorrRFlow = (int)(sbyte)q2CorrRFlow; + if (q2CorrType != Q2CorrType.RL) ihead.Q2CorrLFlow = (int)(sbyte)q2CorrLFlow; #if IPERL if (wm != null) { wm.Q2ErrWOCorrection = ihead.Q2ErrWOCorrection; wm.Q2CorrectionDone = ihead.Q2CorrectionDone; wm.Q2Correction = ihead.Q2Correction; - wm.Q2CorrRFlow = ihead.Q2CorrRFlow; - wm.Q2CorrLFlow = ihead.Q2CorrLFlow; + if (q2CorrType != Q2CorrType.LR) wm.Q2CorrRFlow = ihead.Q2CorrRFlow; + if (q2CorrType != Q2CorrType.RL) wm.Q2CorrLFlow = ihead.Q2CorrLFlow; } #endif } diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationParams.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationParams.cs index 1e2832706..39ac6b05d 100644 --- a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationParams.cs +++ b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationParams.cs @@ -54,6 +54,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication retVal.Add("Write Q2 correction"); retVal.Add("Write Q2 correction Alt"); retVal.Add("Write Q2 correction Greece"); + retVal.Add("Write Q2 correction R-L"); + retVal.Add("Write Q2 correction L-R"); retVal.Add("Q2 corrected from Q2adj"); retVal.Add("Set Active mode"); retVal.Add("---"); diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlEnums.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlEnums.cs index 59519f992..435c0d31a 100644 --- a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlEnums.cs +++ b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlEnums.cs @@ -10,8 +10,12 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication { public enum Q2CorrType { + None, Standard, Dewa, - Greece + Greece, + RL, + LR, + Count } } diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index 3d92a02e0..431144c9b 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.18.998.0")] -[assembly: AssemblyFileVersion("2.18.998.0")] +[assembly: AssemblyVersion("2.18.999.0")] +[assembly: AssemblyFileVersion("2.18.999.0")]