iPerlCommunicationForm : "DEWA rework" activity
This commit is contained in:
parent
abb2375500
commit
2cc92f3980
@ -88,6 +88,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
public const string ConditnlUpdateQ2CorrLRStr = "Conditional update of Q2 correction L-R"; /// Arguments: L-R_test_name
|
||||
public const string Reset2HzCorrectionStr = "Reset 2Hz correction";
|
||||
public const string Write2HzCorrectionStr = "Write 2Hz correction";
|
||||
public const string DewaReworkStr = "DEWA rework";
|
||||
|
||||
public static Color DisabledColor = Color.DarkGray;
|
||||
public static Color OptoAndDirOKColor = Color.Green;
|
||||
@ -843,6 +844,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
else if (currentActivity.ToLower() == Reset2HzCorrectionStr.ToLower()) error = Reset2HzCorrection(threadID, ihead, wm, ref resultStr);
|
||||
else if (currentActivity.ToLower() == Write2HzCorrectionStr.ToLower()) error = Write2HzCorrection(threadID, ihead, wm, ref resultStr);
|
||||
else if (currentActivity.ToLower() == GetDefaultQ2CorrectionsStr.ToLower()) error = GetQ2PreCorrectionsFormRest(threadID, ihead, wm, ref resultStr);
|
||||
else if (currentActivity.ToLower() == DewaReworkStr.ToLower()) error = DewaRework(threadID, ihead, wm, ref resultStr);
|
||||
|
||||
#endif
|
||||
else
|
||||
@ -2562,6 +2564,63 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// DEWA rework.
|
||||
/// </summary>
|
||||
/// <param name="ihead">iPERL head object</param>
|
||||
/// <param name="wm">Water meter object</param>
|
||||
/// <param name="resultStr">String passed to caller</param>
|
||||
/// <returns>true on success</returns>
|
||||
static CommErr DewaRework(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
|
||||
{
|
||||
iPerlDataWrite[] dataToBeWritten = new iPerlDataWrite[]
|
||||
{
|
||||
new iPerlDataWrite(MessageID.MetrologyMemory, 0x19A1, new byte[] { (byte)0xA5 }, "Open Sealing"),
|
||||
new iPerlDataWrite(MessageID.RadioPassthrough, 0x1804, new byte[] { (byte)1 }, "System Status"),
|
||||
new iPerlDataWrite(MessageID.MetrologyMemory, 0x1985, new byte[] { (byte)2 }, "Arrow"),
|
||||
new iPerlDataWrite(MessageID.MetrologyMemory, 0x199C, new byte[5], "Clear S/N"),
|
||||
new iPerlDataWrite(MessageID.Command, 0x0000, new byte[] { (byte)Command.SetActiveMode }, "Set active mode"),
|
||||
new iPerlDataWrite(MessageID.Configuration, 0x0015, new byte[] { (byte)0xA0 }, "Test mode config = A0"),
|
||||
new iPerlDataWrite(MessageID.MetrologyMemory, 0x198E, new byte[] { (byte)(2510 & 0xFF), (byte)((2510 >> 8) & 0xFF) }, "Receipt mean current"),
|
||||
new iPerlDataWrite(MessageID.RadioPassthrough, 0x18A2, new byte[] { (byte)0x4A, (byte)0x53, (byte)0x3B, (byte)0x8F,
|
||||
(byte)0x70, (byte)0x31, (byte)0xC2, (byte)0x5D,
|
||||
(byte)0x6F, (byte)0x2D, (byte)0xE8, (byte)0x07,
|
||||
(byte)0x6E, (byte)0x0F, (byte)0x97, (byte)0xC3, }, "AES Key Crypted"),
|
||||
};
|
||||
|
||||
if (ihead.CommFailed) return CommErr.CommFailed;
|
||||
|
||||
int successfyllyWrittenFlags = 0; /// Ones in this word represent communication failures, LSB represents the first step
|
||||
int mask = 1;
|
||||
foreach (var wData in dataToBeWritten)
|
||||
{
|
||||
bool isSuccessfullyWritten = false;
|
||||
for (int j = 0; j < cfg.MaxCommRetries; j++)
|
||||
{
|
||||
if (0 == WriteRequestPort(threadId, ihead, wData.MessageID, wData.Offset, wData.Data.Length, wData.Data, cfg.CommTimeout))
|
||||
{
|
||||
isSuccessfullyWritten = true;
|
||||
break;
|
||||
}
|
||||
|
||||
/// Delay between retries
|
||||
if (cfg.DelayBetweenRetries > 0) Thread.Sleep(cfg.DelayBetweenRetries);
|
||||
}
|
||||
|
||||
if (!isSuccessfullyWritten)
|
||||
{
|
||||
/// Communication failed in this step
|
||||
successfyllyWrittenFlags = (successfyllyWrittenFlags | mask);
|
||||
}
|
||||
|
||||
mask = (mask << 1); /// Adjust the mask for the next step
|
||||
}
|
||||
|
||||
return (successfyllyWrittenFlags == 0) ? CommErr.None : CommErr.Write;
|
||||
}
|
||||
|
||||
|
||||
static CommErr GetQ2PreCorrectionsFormRest(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
|
||||
{
|
||||
if (!ProcessData.IsQ2PreCorrectionCalculated)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
@ -79,6 +79,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
retVal.Add("---");
|
||||
retVal.Add(iPerlCommunicationForm.Reset2HzCorrectionStr);
|
||||
retVal.Add(iPerlCommunicationForm.Write2HzCorrectionStr);
|
||||
retVal.Add(iPerlCommunicationForm.DewaReworkStr);
|
||||
retVal.Add(string.Format("{0} if enabled", iPerlCommunicationForm.ReadConfigurationStr));
|
||||
retVal.Add(string.Format("{0} 80", iPerlCommunicationForm.SetTestModeStr));
|
||||
retVal.Add("iPerl_check prevWorkStep direction q2factors");
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
{
|
||||
public class iPerlDataWrite
|
||||
{
|
||||
public MessageID MessageID;
|
||||
public int Offset;
|
||||
public byte[] Data;
|
||||
public string Description;
|
||||
|
||||
public iPerlDataWrite(MessageID mesageID, int offset, byte[] data, string description)
|
||||
{
|
||||
MessageID = mesageID;
|
||||
Offset = offset;
|
||||
Data = data;
|
||||
Description = description;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.26.1729.0")]
|
||||
[assembly: AssemblyFileVersion("2.26.1729.0")]
|
||||
[assembly: AssemblyVersion("2.26.1735.0")]
|
||||
[assembly: AssemblyFileVersion("2.26.1735.0")]
|
||||
|
||||
@ -1597,6 +1597,7 @@
|
||||
<Compile Include="BenchControl\TestMethods\iPerlCommunication\iPerlCommunicationForm.designer.cs">
|
||||
<DependentUpon>iPerlCommunicationForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\TestMethods\iPerlCommunication\iPerlDataWrite.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\iPerlCommunication\iPerlEnums.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\iPerlCommunication\iPerlHead\CalibrationStruct.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\iPerlCommunication\iPerlHead\CalibrationStructV4.cs" />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user