diff --git a/Common/Common.sln.DotSettings b/Common/Common.sln.DotSettings
index 24aa8d10..e2741c0c 100644
--- a/Common/Common.sln.DotSettings
+++ b/Common/Common.sln.DotSettings
@@ -4,6 +4,8 @@
True
True
True
+ True
+
True
True
True
diff --git a/Common/Hardware/Interfaces/Ports/SerialPorts/IrdaSerialPort.cs b/Common/Hardware/Interfaces/Ports/SerialPorts/IrdaSerialPort.cs
index b1ec6ff1..a8f2e4c2 100644
--- a/Common/Hardware/Interfaces/Ports/SerialPorts/IrdaSerialPort.cs
+++ b/Common/Hardware/Interfaces/Ports/SerialPorts/IrdaSerialPort.cs
@@ -38,7 +38,7 @@ namespace Xylem.Common.Hardware.Interfaces.Ports.SerialPorts
//delay at least 500 µs
var delayPattern = new Byte[] { 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F };
PhysicalWrite(delayPattern);
-
+
//send the IrDA record
PhysicalWrite(tx);
}
diff --git a/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs b/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs
index 14fddfa8..6e7a2b46 100644
--- a/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs
+++ b/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs
@@ -1052,6 +1052,16 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
///
public String FwVersion;
+ ///
+ /// This is the Metrology Lookup Table CRC.
+ ///
+ public String LutCrc;
+
+ ///
+ /// This is the meter size.
+ ///
+ public String MeterSize;
+
///
/// Region (EMEA or NA) and Radio frequency (433 or 868 or null).
///
@@ -1107,8 +1117,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
//build the version string, because e.g. FLEXNETVERSION is one application which does not
//follow the same rule. After the upper conversion, the hexadecimal outline will be lost
versionString = BuildFwVersionString(readFwVersionBytes[1], readFwVersionBytes[0]);
- if (appVersionToRead.AppName == "FLEXNETVERSION")
- FwVersion = versionString;
+ if (appVersionToRead.AppName == "FLEXNETVERSION") FwVersion = versionString;
if (readFwVersion != 0)
{
@@ -1139,6 +1148,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
MetrologyUpgradePermission = RegisterConverter.ConvertTo(
ReadRegister(Register.System.MetrologyUpgradePermission));
+ //read metrology lookup table CRC
+ var lutCrc = RegisterConverter.ConvertTo(ReadRegister(Register.Genesisflow.LookupFileCrc));
+ LutCrc = $@"0x{lutCrc:X4}";
+
+
+ //read meter size
+ MeterSize = MeterSizeConverter.ConvertMeterSizeEnumToSizeName((MeterSize)RegisterConverter.ConvertTo(
+ ReadRegister(Register.Genesisflow.MeterSize)));
+
//read core revision
var coreRegisterRead = RegisterConverter.ConvertTo(ReadRegister(Register.System.CoreRevision, 16));
var coreRevision = coreRegisterRead?.Split('\0');
diff --git a/Common/Hardware/WaterMeter/Genesis/GenesisFile/MeterFile.cs b/Common/Hardware/WaterMeter/Genesis/GenesisFile/MeterFile.cs
index ff04567c..57b3cbe3 100644
--- a/Common/Hardware/WaterMeter/Genesis/GenesisFile/MeterFile.cs
+++ b/Common/Hardware/WaterMeter/Genesis/GenesisFile/MeterFile.cs
@@ -560,7 +560,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
//set extended timeout for file operations
_currentGenesis.TransmitProtocol.SetResponseTimeout(ExtendedFileIoTimeoutMs);
CommunicationConfig.RequestRetries = 0;
- //write "remove-command" to meter, wait for result and read back (read back returns false because of unreadable content)
+ //write "remove-command" to meter, wait for result and read back
+ //ATTENTION: read back returns FALSE because of unreadable content
_currentGenesis.WriteRegister(Register.Configexchange.FileRemove, fileName, true, true);
//set timeout back to default value
_currentGenesis.TransmitProtocol.SetDefaultResponseTimeout();
diff --git a/Common/Hardware/WaterMeter/Genesis/GenesisFile/MeterLutUpdate.cs b/Common/Hardware/WaterMeter/Genesis/GenesisFile/MeterLutUpdate.cs
index e01f1785..6088258e 100644
--- a/Common/Hardware/WaterMeter/Genesis/GenesisFile/MeterLutUpdate.cs
+++ b/Common/Hardware/WaterMeter/Genesis/GenesisFile/MeterLutUpdate.cs
@@ -67,13 +67,13 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
private const String StrProcessLut = "Processing metrology lookup table";
//trigger update retries
- private const Int32 RegisterWriteRetries = 2;
+ private const Int32 RegisterWriteRetries = 0;
//update reties for files
private const Int32 FileWriteRetries = 0;
//retry of entire update procedure
- private const Int32 UpdateProcedureRetries = 5;
+ private const Int32 UpdateProcedureRetries = 0;
//threshold to increase the file write timing
private const Int32 IncreaseTimeoutUpdateProcedureRetries = 4;
@@ -87,17 +87,22 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
private String _actualOperation;
private LutUpdateState _lutUpdateState;
- // Process counter for caller to monitor actual progress
- private Int32 _processedBytesCtr;
- private Int32 _overallBytesCtr;
-
// Look up table file
public MeterLutFile LutFile;
// actual processed file
private String _actualFileName;
+ // list of names of installed meter files on drive 1
+ private List _meterFilesDrive1;
+ // number of operations for over all access
+ private const Int32 NumberOfOperations = 11;
+ private Int32 _operationCtr;
+
+
+ // error message for display of error reason
+ public String ErrorMessage;
#endregion
#region Events
@@ -124,18 +129,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
///
/// Process counter in percent
///
- ///
+ ///
/// - Initial
///
- public Double OverallProcessCtrPercent
- {
- get
- {
- var processFileBytes = _meterFile?.ProcessedBytesCtr ?? 0;
- return 100.0 * (processFileBytes + _processedBytesCtr) /
- (_overallBytesCtr > 0 ? _overallBytesCtr : 1);
- }
- }
+ public Double OverallProcessCtrPercent => 100.0 * _operationCtr / NumberOfOperations;
///
/// Single file process counter in percent
@@ -211,7 +208,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
///
public String GetLutUpdateStateOperation()
{
- return _lutUpdateState == LutUpdateState.Idle ? "" : $"Downloading {_actualFileName}...";
+ return _lutUpdateState == LutUpdateState.Idle ? "" : "Processing...";
}
#endregion
@@ -270,6 +267,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
return false;
}
+ _operationCtr = 0;
+ _actualOperation = "";
+ ErrorMessage = "";
_lutUpdateState = LutUpdateState.StartInitial;
while (_lutUpdateState != LutUpdateState.Idle && !StopUpdateProcess)
{
@@ -308,13 +308,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
StopUpdateProcess = false;
//reset all counters
- _processedBytesCtr = 0;
- _overallBytesCtr = 0;
_updateProcedureRetryCtr = 0;
//set state machine for automatic FW update
_lutUpdateState = LutUpdateState.Idle;
_actualOperation = "";
+ _operationCtr = 0;
//logout/login/auto-login
ReestablishMeterFileSystem();
@@ -402,8 +401,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
break;
case LutUpdateState.StepFailed:
- _processedBytesCtr = 0;
- _overallBytesCtr = 0;
_lutUpdateState = _updateProcedureRetryCtr++ < UpdateProcedureRetries
? LutUpdateState.RepeatLutUpdate
@@ -411,8 +408,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
break;
case LutUpdateState.RepeatLutUpdate:
- _processedBytesCtr = 0;
- _overallBytesCtr = 0;
_lutUpdateState = LutUpdateState.DownloadLutFile;
if (_updateProcedureRetryCtr >= IncreaseTimeoutUpdateProcedureRetries)
{
@@ -422,8 +417,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
break;
case LutUpdateState.UpdateFailed:
- _processedBytesCtr = 0;
- _overallBytesCtr = 0;
StopUpdateProcess = true;
_lutUpdateState = LutUpdateState.Idle;
break;
@@ -457,7 +450,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
private Boolean ValidateLutFile()
{
// check if LUT file contains data
- if (LutFile?.BinData == null || LutFile.BinData.Count < SizeLutFile) return false;
+ if (LutFile?.BinData == null || LutFile.BinData.Count < SizeLutFile)
+ {
+ ErrorMessage += "File size mismatch!";
+ return false;
+ }
LutFile.IsValid = false;
// extract the identifier and check, if this is a LUT file
@@ -478,13 +475,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
var payload = new List();
payload.AddRange(entireFile.GetRange(IndexVersion, LutFileDataLength + LengthVersion));
var calculatedCrc = Crc16Ccitt.CalculateMsb1021(payload.ToArray());
- if (calculatedCrc == LutFile.FileCrc)
+ if (calculatedCrc != LutFile.FileCrc)
{
- LutFile.CalculatedCrc = calculatedCrc;
- LutFile.IsValid = true;
- return true;
+ ErrorMessage += "CRC Mismatch!";
+ return false;
}
- return false;
+
+ LutFile.CalculatedCrc = calculatedCrc;
+ LutFile.IsValid = true;
+ return true;
}
///
@@ -496,21 +495,44 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
///
private Boolean PrepareLutDownload()
{
- Boolean returnValue;
- _actualOperation = "Write Meter Size";
-
+ var returnValue = true;
+
var retryCtr = 0;
if (LutFile == null || _genesisMeter == null || _meterFile == null) return false;
//set extended timeout for trigger upgrade response delay
_genesisMeter.TransmitProtocol.SetResponseTimeout(5000);
do
{
- _actualOperation = "Write Meter Size";
- returnValue = _genesisMeter.WriteRegister(Register.Genesisflow.MeterSize, (Byte)LutFile.MeterSize);
- _actualOperation = "Write CRC";
- returnValue &= _genesisMeter.WriteRegister(Register.Genesisflow.LookupFileCrc, LutFile.FileCrc);
- _actualOperation = "Store calibration";
- returnValue &= _genesisMeter.WriteRegister(Register.Genesisflow.StoreCalibration, 1);
+ _actualOperation = "Write meter size";
+ _operationCtr++;
+ if (!_genesisMeter.WriteRegister(Register.Genesisflow.MeterSize, (Byte)LutFile.MeterSize))
+ {
+ ErrorMessage = "Meter size could not be set!\n";
+ _operationCtr--;
+ returnValue = false;
+ }
+ else
+ {
+ _operationCtr++;
+ _actualOperation = "Write Lut CRC to meter";
+ if (!_genesisMeter.WriteRegister(Register.Genesisflow.LookupFileCrc, LutFile.FileCrc))
+ {
+ ErrorMessage += "Meter LUT CRC could not be set!\n";
+ _operationCtr--;
+ returnValue = false;
+ }
+ else
+ {
+ _operationCtr++;
+ _actualOperation = "Store calibration to meter";
+ if (!_genesisMeter.WriteRegister(Register.Genesisflow.StoreCalibration, 1))
+ {
+ ErrorMessage += "Meter store calibration failed!\n";
+ _operationCtr--;
+ returnValue = false;
+ }
+ }
+ }
if (!returnValue)
{
@@ -525,7 +547,36 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
}
///
- /// Download the metrology lookup table files
+ /// Erase file and check if done!
+ ///
+ ///
+ ///
+ /// - Initial
+ ///
+ private Boolean EraseFile(String fileDriveName)
+ {
+ var returnValue = _meterFile.UnlockEraseWriteMeterFile(fileDriveName);
+ //erase returns always TRUE, even if the erasure failed! Check with catalogue
+ _meterFile.EraseMeterFile(fileDriveName);
+ _meterFilesDrive1.Clear();
+ if (_meterFile.ReadMeterFileCatalog(out var meterFilesDrive1, MeterFile.StrMeterDrive1,
+ MeterFile.WildcardAll.ToString()))
+ {
+ _meterFilesDrive1.AddRange(meterFilesDrive1);
+ if (_meterFilesDrive1.Contains(fileDriveName))
+ {
+ returnValue = false;
+ }
+ }
+ else
+ {
+ returnValue = false;
+ }
+ return returnValue;
+ }
+
+ ///
+ /// Download the metrology lookup table files and read the catalog of drive 1
///
///
///
@@ -535,32 +586,97 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
{
//counters for actual process information
- _processedBytesCtr = 0;
- _overallBytesCtr = 0;
var retryCtr = 0;
- Boolean returnValue;
-
if (LutFile == null) return false;
+ //set extended timeout for trigger upgrade response delay
+ _genesisMeter.TransmitProtocol.SetResponseTimeout(5000);
+ var returnValue = true;
//write file portion and retry if not successful
do
{
+ // read all files which are already installed
+ _actualOperation = "Read installed meter files drive 1";
+ _operationCtr++;
+ if (_meterFilesDrive1 == null)
+ {
+ _meterFilesDrive1 = new List();
+ }
+ _meterFilesDrive1.Clear();
+ if (_meterFile.ReadMeterFileCatalog(out var meterFilesDrive1, MeterFile.StrMeterDrive1,
+ MeterFile.WildcardAll.ToString()))
+ {
+ _meterFilesDrive1.AddRange(meterFilesDrive1);
+ }
+ // erase file
+ _operationCtr++;
_actualFileName = StrLutMeterFileName;
- // unlock, erase and write original
- returnValue = _meterFile.UnlockEraseWriteMeterFile(_actualFileName);
_actualOperation = $"Erase {_actualFileName}";
- returnValue &= _meterFile.EraseMeterFile(_actualFileName);
+ if (!EraseFile(_actualFileName))
+ {
+ ErrorMessage += $"LUT file {_actualFileName} not erased!\n";
+ returnValue = false;
+ }
+
+ _operationCtr++;
_actualOperation = $"Write {_actualFileName}";
- returnValue &= _meterFile.WriteMeterFile(_actualFileName, LutFile.BinData.ToArray());
+ if (!_meterFile.WriteMeterFile(_actualFileName, LutFile.BinData.ToArray()))
+ {
+ ErrorMessage += $"Writing of {_actualFileName} failed!\n";
+ returnValue = false;
+ }
+ // erase file
+ _operationCtr++;
_actualFileName = StrLutBackupMeterFileName;
- // write backup
- returnValue &= _meterFile.UnlockEraseWriteMeterFile(_actualFileName);
_actualOperation = $"Erase {_actualFileName}";
- returnValue &= _meterFile.EraseMeterFile(_actualFileName);
+ if (!EraseFile(_actualFileName))
+ {
+ ErrorMessage += $"LUT file {_actualFileName} not erased!\n";
+ returnValue = false;
+ }
+
+ _operationCtr++;
_actualOperation = $"Write {_actualFileName}";
- returnValue &= _meterFile.WriteMeterFile(_actualFileName, LutFile.BinData.ToArray());
+ if (!_meterFile.WriteMeterFile(_actualFileName, LutFile.BinData.ToArray()))
+ {
+ ErrorMessage += $"Writing of {_actualFileName} failed!\n";
+ returnValue = false;
+ }
+
+
+ _operationCtr++;
+ _actualOperation = $"Write {_actualFileName}";
+ if (!_meterFile.WriteMeterFile(_actualFileName, LutFile.BinData.ToArray()))
+ {
+ ErrorMessage += $"Writing of {_actualFileName} failed!\n";
+ returnValue = false;
+ }
+
+ _operationCtr++;
+ _actualOperation = "Read installed meter files drive 1";
+ _meterFilesDrive1.Clear();
+ if (!_meterFile.ReadMeterFileCatalog(out meterFilesDrive1, MeterFile.StrMeterDrive1,
+ MeterFile.WildcardAll.ToString()))
+ {
+ returnValue = false;
+ }
+ else
+ {
+ _meterFilesDrive1.AddRange(meterFilesDrive1);
+ if (!_meterFilesDrive1.Contains(StrLutMeterFileName))
+ {
+ ErrorMessage += $"LUT file {StrLutMeterFileName} not installed!\n";
+ returnValue = false;
+ }
+
+ if (!_meterFilesDrive1.Contains(StrLutBackupMeterFileName))
+ {
+ ErrorMessage += $"LUT file {StrLutBackupMeterFileName} not installed!\n";
+ returnValue = false;
+ }
+ }
if (!returnValue)
{
@@ -568,10 +684,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
}
} while (!returnValue && retryCtr++ < FileWriteRetries && !StopUpdateProcess);
- returnValue &= retryCtr <= FileWriteRetries;
-
- //update information for process bar
- _processedBytesCtr += LutFile.BinData.Count;
+ //set timeout back to default value
+ _genesisMeter.TransmitProtocol.SetDefaultResponseTimeout();
return !StopUpdateProcess && returnValue;
}
diff --git a/Common/Hardware/WaterMeter/Genesis/Registers/Registers.cs b/Common/Hardware/WaterMeter/Genesis/Registers/Registers.cs
index 2581f845..2ab9cf09 100644
--- a/Common/Hardware/WaterMeter/Genesis/Registers/Registers.cs
+++ b/Common/Hardware/WaterMeter/Genesis/Registers/Registers.cs
@@ -83,7 +83,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
public static readonly String NumFirePulses = "GENESISFLOW_NumFirePulses";
public static readonly String LookupFileCrc = "GENESISFLOW_LookupFileCrc";
-
};
public static class Powermon
@@ -122,6 +121,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
Configexchange.FileClose,
Configexchange.FileWrite,
Configexchange.FileRead,
+ Configexchange.Catalogue,
Configexchange.GetFilePointerOffset,
Configexchange.SetFilePointerOffset,
Configexchange.FileRemove,
@@ -136,6 +136,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
Genesisflow.TriggerIdle,
Genesisflow.LedMode,
Genesisflow.SampleRate,
+ Genesisflow.MeterSize,
+ Genesisflow.LookupFileCrc,
+ Genesisflow.StoreCalibration,
Sensusradio.WakeupInterval,
Sensusradio.FrequencyIndicator
diff --git a/Common/Ui/GenesisToolBox/FrmLutUpdate.Designer.cs b/Common/Ui/GenesisToolBox/FrmLutUpdate.Designer.cs
index b67f07c2..32c01bd5 100644
--- a/Common/Ui/GenesisToolBox/FrmLutUpdate.Designer.cs
+++ b/Common/Ui/GenesisToolBox/FrmLutUpdate.Designer.cs
@@ -30,6 +30,12 @@
{
this.components = new System.ComponentModel.Container();
this.grpSetup = new System.Windows.Forms.GroupBox();
+ this.tbxPcbId = new System.Windows.Forms.TextBox();
+ this.tbxMeterFw = new System.Windows.Forms.TextBox();
+ this.tbxMeterMeterSize = new System.Windows.Forms.TextBox();
+ this.tbxMeterLutCrc = new System.Windows.Forms.TextBox();
+ this.label5 = new System.Windows.Forms.Label();
+ this.label6 = new System.Windows.Forms.Label();
this.lblFwVersion = new System.Windows.Forms.Label();
this.btnConnect = new System.Windows.Forms.Button();
this.lblConnectPcb = new System.Windows.Forms.Label();
@@ -48,16 +54,16 @@
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.tbxFileMeterSize = new System.Windows.Forms.TextBox();
+ this.tbxFileCrc = new System.Windows.Forms.TextBox();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label1 = new System.Windows.Forms.Label();
this.lblLutFileLoadedInfo = new System.Windows.Forms.Label();
this.tbxLutFilePathName = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.btnOpenLutFile = new System.Windows.Forms.Button();
this.label9 = new System.Windows.Forms.Label();
this.lblUpdateTime = new System.Windows.Forms.Label();
- this.label1 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.tbxFileCrc = new System.Windows.Forms.TextBox();
- this.tbxMeterSize = new System.Windows.Forms.TextBox();
this.grpSetup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.groupBox1.SuspendLayout();
@@ -65,6 +71,12 @@
//
// grpSetup
//
+ this.grpSetup.Controls.Add(this.tbxPcbId);
+ this.grpSetup.Controls.Add(this.tbxMeterFw);
+ this.grpSetup.Controls.Add(this.tbxMeterMeterSize);
+ this.grpSetup.Controls.Add(this.tbxMeterLutCrc);
+ this.grpSetup.Controls.Add(this.label5);
+ this.grpSetup.Controls.Add(this.label6);
this.grpSetup.Controls.Add(this.lblFwVersion);
this.grpSetup.Controls.Add(this.btnConnect);
this.grpSetup.Controls.Add(this.lblConnectPcb);
@@ -72,25 +84,75 @@
this.grpSetup.Controls.Add(this.cbComSlot);
this.grpSetup.Location = new System.Drawing.Point(12, 56);
this.grpSetup.Name = "grpSetup";
- this.grpSetup.Size = new System.Drawing.Size(248, 153);
+ this.grpSetup.Size = new System.Drawing.Size(248, 212);
this.grpSetup.TabIndex = 24;
this.grpSetup.TabStop = false;
this.grpSetup.Text = "Connection";
//
+ // tbxPcbId
+ //
+ this.tbxPcbId.Location = new System.Drawing.Point(126, 27);
+ this.tbxPcbId.Name = "tbxPcbId";
+ this.tbxPcbId.ReadOnly = true;
+ this.tbxPcbId.Size = new System.Drawing.Size(68, 20);
+ this.tbxPcbId.TabIndex = 32;
+ //
+ // tbxMeterFw
+ //
+ this.tbxMeterFw.Location = new System.Drawing.Point(126, 56);
+ this.tbxMeterFw.Name = "tbxMeterFw";
+ this.tbxMeterFw.ReadOnly = true;
+ this.tbxMeterFw.Size = new System.Drawing.Size(68, 20);
+ this.tbxMeterFw.TabIndex = 31;
+ //
+ // tbxMeterMeterSize
+ //
+ this.tbxMeterMeterSize.Location = new System.Drawing.Point(126, 116);
+ this.tbxMeterMeterSize.Name = "tbxMeterMeterSize";
+ this.tbxMeterMeterSize.ReadOnly = true;
+ this.tbxMeterMeterSize.Size = new System.Drawing.Size(68, 20);
+ this.tbxMeterMeterSize.TabIndex = 30;
+ //
+ // tbxMeterLutCrc
+ //
+ this.tbxMeterLutCrc.Location = new System.Drawing.Point(126, 86);
+ this.tbxMeterLutCrc.Name = "tbxMeterLutCrc";
+ this.tbxMeterLutCrc.ReadOnly = true;
+ this.tbxMeterLutCrc.Size = new System.Drawing.Size(68, 20);
+ this.tbxMeterLutCrc.TabIndex = 29;
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(10, 120);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(60, 13);
+ this.label5.TabIndex = 28;
+ this.label5.Text = "Meter Size:";
+ //
+ // label6
+ //
+ this.label6.AutoSize = true;
+ this.label6.Location = new System.Drawing.Point(9, 90);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(56, 13);
+ this.label6.TabIndex = 27;
+ this.label6.Text = "LUT CRC:";
+ //
// lblFwVersion
//
this.lblFwVersion.AutoSize = true;
- this.lblFwVersion.Location = new System.Drawing.Point(10, 60);
+ this.lblFwVersion.Location = new System.Drawing.Point(9, 60);
this.lblFwVersion.Name = "lblFwVersion";
- this.lblFwVersion.Size = new System.Drawing.Size(55, 13);
+ this.lblFwVersion.Size = new System.Drawing.Size(57, 13);
this.lblFwVersion.TabIndex = 25;
- this.lblFwVersion.Text = "----------------";
+ this.lblFwVersion.Text = "Meter FW:";
//
// btnConnect
//
- this.btnConnect.Location = new System.Drawing.Point(126, 113);
+ this.btnConnect.Location = new System.Drawing.Point(126, 181);
this.btnConnect.Name = "btnConnect";
- this.btnConnect.Size = new System.Drawing.Size(116, 24);
+ this.btnConnect.Size = new System.Drawing.Size(116, 25);
this.btnConnect.TabIndex = 24;
this.btnConnect.Text = "Connect";
this.btnConnect.UseVisualStyleBackColor = true;
@@ -101,14 +163,14 @@
this.lblConnectPcb.AutoSize = true;
this.lblConnectPcb.Location = new System.Drawing.Point(10, 30);
this.lblConnectPcb.Name = "lblConnectPcb";
- this.lblConnectPcb.Size = new System.Drawing.Size(100, 13);
+ this.lblConnectPcb.Size = new System.Drawing.Size(33, 13);
this.lblConnectPcb.TabIndex = 23;
- this.lblConnectPcb.Text = "NOT CONNECTED";
+ this.lblConnectPcb.Text = "NOT ";
//
// label2
//
this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(10, 89);
+ this.label2.Location = new System.Drawing.Point(10, 156);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(28, 13);
this.label2.TabIndex = 20;
@@ -138,7 +200,7 @@
"18",
"19",
"20"});
- this.cbComSlot.Location = new System.Drawing.Point(43, 85);
+ this.cbComSlot.Location = new System.Drawing.Point(126, 150);
this.cbComSlot.Name = "cbComSlot";
this.cbComSlot.Size = new System.Drawing.Size(37, 21);
this.cbComSlot.TabIndex = 5;
@@ -149,7 +211,7 @@
//
this.lblWaitingForMeterResponse.AutoSize = true;
this.lblWaitingForMeterResponse.ForeColor = System.Drawing.Color.Red;
- this.lblWaitingForMeterResponse.Location = new System.Drawing.Point(532, 223);
+ this.lblWaitingForMeterResponse.Location = new System.Drawing.Point(532, 281);
this.lblWaitingForMeterResponse.Name = "lblWaitingForMeterResponse";
this.lblWaitingForMeterResponse.Size = new System.Drawing.Size(182, 13);
this.lblWaitingForMeterResponse.TabIndex = 18;
@@ -157,7 +219,7 @@
//
// btnStopFwUpdate
//
- this.btnStopFwUpdate.Location = new System.Drawing.Point(310, 113);
+ this.btnStopFwUpdate.Location = new System.Drawing.Point(310, 181);
this.btnStopFwUpdate.Name = "btnStopFwUpdate";
this.btnStopFwUpdate.Size = new System.Drawing.Size(116, 25);
this.btnStopFwUpdate.TabIndex = 8;
@@ -167,7 +229,7 @@
//
// btnDownloadLutFile
//
- this.btnDownloadLutFile.Location = new System.Drawing.Point(310, 84);
+ this.btnDownloadLutFile.Location = new System.Drawing.Point(310, 147);
this.btnDownloadLutFile.Name = "btnDownloadLutFile";
this.btnDownloadLutFile.Size = new System.Drawing.Size(116, 25);
this.btnDownloadLutFile.TabIndex = 0;
@@ -178,7 +240,7 @@
// lblOverall
//
this.lblOverall.AutoSize = true;
- this.lblOverall.Location = new System.Drawing.Point(21, 260);
+ this.lblOverall.Location = new System.Drawing.Point(21, 318);
this.lblOverall.Name = "lblOverall";
this.lblOverall.Size = new System.Drawing.Size(80, 13);
this.lblOverall.TabIndex = 7;
@@ -186,7 +248,7 @@
//
// barSingleProgressUpdate
//
- this.barSingleProgressUpdate.Location = new System.Drawing.Point(12, 239);
+ this.barSingleProgressUpdate.Location = new System.Drawing.Point(12, 297);
this.barSingleProgressUpdate.Name = "barSingleProgressUpdate";
this.barSingleProgressUpdate.Size = new System.Drawing.Size(702, 18);
this.barSingleProgressUpdate.TabIndex = 6;
@@ -195,7 +257,7 @@
// lblActualProcess
//
this.lblActualProcess.AutoSize = true;
- this.lblActualProcess.Location = new System.Drawing.Point(21, 223);
+ this.lblActualProcess.Location = new System.Drawing.Point(21, 281);
this.lblActualProcess.Name = "lblActualProcess";
this.lblActualProcess.Size = new System.Drawing.Size(76, 13);
this.lblActualProcess.TabIndex = 4;
@@ -203,7 +265,7 @@
//
// barOverallProgressUpdate
//
- this.barOverallProgressUpdate.Location = new System.Drawing.Point(12, 276);
+ this.barOverallProgressUpdate.Location = new System.Drawing.Point(12, 334);
this.barOverallProgressUpdate.Name = "barOverallProgressUpdate";
this.barOverallProgressUpdate.Size = new System.Drawing.Size(702, 18);
this.barOverallProgressUpdate.TabIndex = 3;
@@ -222,7 +284,7 @@
//
this.lblFwUpdateInfo.AutoSize = true;
this.lblFwUpdateInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblFwUpdateInfo.Location = new System.Drawing.Point(12, 34);
+ this.lblFwUpdateInfo.Location = new System.Drawing.Point(527, 6);
this.lblFwUpdateInfo.Name = "lblFwUpdateInfo";
this.lblFwUpdateInfo.Size = new System.Drawing.Size(72, 13);
this.lblFwUpdateInfo.TabIndex = 27;
@@ -243,7 +305,7 @@
//
// groupBox1
//
- this.groupBox1.Controls.Add(this.tbxMeterSize);
+ this.groupBox1.Controls.Add(this.tbxFileMeterSize);
this.groupBox1.Controls.Add(this.tbxFileCrc);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label1);
@@ -255,15 +317,49 @@
this.groupBox1.Controls.Add(this.btnOpenLutFile);
this.groupBox1.Location = new System.Drawing.Point(278, 56);
this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(436, 153);
+ this.groupBox1.Size = new System.Drawing.Size(436, 212);
this.groupBox1.TabIndex = 28;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Lookup Table";
//
+ // tbxFileMeterSize
+ //
+ this.tbxFileMeterSize.Location = new System.Drawing.Point(104, 116);
+ this.tbxFileMeterSize.Name = "tbxFileMeterSize";
+ this.tbxFileMeterSize.ReadOnly = true;
+ this.tbxFileMeterSize.Size = new System.Drawing.Size(68, 20);
+ this.tbxFileMeterSize.TabIndex = 13;
+ //
+ // tbxFileCrc
+ //
+ this.tbxFileCrc.Location = new System.Drawing.Point(104, 86);
+ this.tbxFileCrc.Name = "tbxFileCrc";
+ this.tbxFileCrc.ReadOnly = true;
+ this.tbxFileCrc.Size = new System.Drawing.Size(68, 20);
+ this.tbxFileCrc.TabIndex = 12;
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(10, 120);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(60, 13);
+ this.label3.TabIndex = 11;
+ this.label3.Text = "Meter Size:";
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(10, 90);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(51, 13);
+ this.label1.TabIndex = 10;
+ this.label1.Text = "File CRC:";
+ //
// lblLutFileLoadedInfo
//
this.lblLutFileLoadedInfo.AutoSize = true;
- this.lblLutFileLoadedInfo.Location = new System.Drawing.Point(10, 120);
+ this.lblLutFileLoadedInfo.Location = new System.Drawing.Point(10, 60);
this.lblLutFileLoadedInfo.Name = "lblLutFileLoadedInfo";
this.lblLutFileLoadedInfo.Size = new System.Drawing.Size(97, 13);
this.lblLutFileLoadedInfo.TabIndex = 9;
@@ -271,7 +367,7 @@
//
// tbxLutFilePathName
//
- this.tbxLutFilePathName.Location = new System.Drawing.Point(104, 23);
+ this.tbxLutFilePathName.Location = new System.Drawing.Point(104, 27);
this.tbxLutFilePathName.Name = "tbxLutFilePathName";
this.tbxLutFilePathName.ReadOnly = true;
this.tbxLutFilePathName.Size = new System.Drawing.Size(322, 20);
@@ -288,7 +384,7 @@
//
// btnOpenLutFile
//
- this.btnOpenLutFile.Location = new System.Drawing.Point(310, 53);
+ this.btnOpenLutFile.Location = new System.Drawing.Point(310, 112);
this.btnOpenLutFile.Name = "btnOpenLutFile";
this.btnOpenLutFile.Size = new System.Drawing.Size(116, 26);
this.btnOpenLutFile.TabIndex = 0;
@@ -299,7 +395,7 @@
// label9
//
this.label9.AutoSize = true;
- this.label9.Location = new System.Drawing.Point(250, 223);
+ this.label9.Location = new System.Drawing.Point(250, 281);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(101, 13);
this.label9.TabIndex = 30;
@@ -308,52 +404,18 @@
// lblUpdateTime
//
this.lblUpdateTime.AutoSize = true;
- this.lblUpdateTime.Location = new System.Drawing.Point(357, 223);
+ this.lblUpdateTime.Location = new System.Drawing.Point(357, 281);
this.lblUpdateTime.Name = "lblUpdateTime";
this.lblUpdateTime.Size = new System.Drawing.Size(28, 13);
this.lblUpdateTime.TabIndex = 31;
this.lblUpdateTime.Text = "0:00";
//
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(10, 60);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(51, 13);
- this.label1.TabIndex = 10;
- this.label1.Text = "File CRC:";
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(10, 90);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(60, 13);
- this.label3.TabIndex = 11;
- this.label3.Text = "Meter Size:";
- //
- // tbxFileCrc
- //
- this.tbxFileCrc.Location = new System.Drawing.Point(104, 56);
- this.tbxFileCrc.Name = "tbxFileCrc";
- this.tbxFileCrc.ReadOnly = true;
- this.tbxFileCrc.Size = new System.Drawing.Size(68, 20);
- this.tbxFileCrc.TabIndex = 12;
- //
- // tbxMeterSize
- //
- this.tbxMeterSize.Location = new System.Drawing.Point(104, 86);
- this.tbxMeterSize.Name = "tbxMeterSize";
- this.tbxMeterSize.ReadOnly = true;
- this.tbxMeterSize.Size = new System.Drawing.Size(68, 20);
- this.tbxMeterSize.TabIndex = 13;
- //
// FrmLutUpdate
//
this.AccessibleRole = System.Windows.Forms.AccessibleRole.Sound;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(723, 317);
+ this.ClientSize = new System.Drawing.Size(723, 364);
this.Controls.Add(this.lblUpdateTime);
this.Controls.Add(this.label9);
this.Controls.Add(this.groupBox1);
@@ -406,9 +468,15 @@
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label lblUpdateTime;
private System.Windows.Forms.Label lblLutFileLoadedInfo;
- private System.Windows.Forms.TextBox tbxMeterSize;
+ private System.Windows.Forms.TextBox tbxFileMeterSize;
private System.Windows.Forms.TextBox tbxFileCrc;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox tbxMeterMeterSize;
+ private System.Windows.Forms.TextBox tbxMeterLutCrc;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.TextBox tbxMeterFw;
+ private System.Windows.Forms.TextBox tbxPcbId;
}
}
\ No newline at end of file
diff --git a/Common/Ui/GenesisToolBox/FrmLutUpdate.cs b/Common/Ui/GenesisToolBox/FrmLutUpdate.cs
index 90a19ebb..dfa0a5dd 100644
--- a/Common/Ui/GenesisToolBox/FrmLutUpdate.cs
+++ b/Common/Ui/GenesisToolBox/FrmLutUpdate.cs
@@ -23,7 +23,6 @@ namespace Xylem.Common.Ui.GenesisToolBox
private GenesisMeter _currentGenesis;
private const String StrConnecting = "Connecting to PCB";
private const String StrNotConnected = "NOT CONNECTED";
- private const String StrFwVersion = "FW: ";
private const String StrPartPcbConnected = "PCB ID: ";
private const String StrOverallProcess = "Overall Process";
@@ -38,8 +37,8 @@ namespace Xylem.Common.Ui.GenesisToolBox
private Boolean _tryConnectPcb;
private Boolean _lutFileSuccessfulWritten;
- private const String StrUpdateErrorMessage = "METROLOGY LOOKUP TABLE UPDATE FAILED!\n\n";
- private const String StrUpdateSuccessMessage = "Metrology lookup table successfulley written!\n\n";
+ private const String StrUpdateErrorMessage = "METROLOGY LOOKUP TABLE UPDATE FAILED!";
+ private const String StrUpdateSuccessMessage = "Metrology lookup table successfulley written!";
private const String StrLutFileInvalid = "LUT FILE INVALID";
private const String StrLutFileValid = "LUT file loaded";
@@ -64,7 +63,6 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
ProcessViewControl(false);
lblConnectPcb.Text = StrNotConnected;
- lblFwVersion.Text = "";
lblConnectPcb.ForeColor = Color.Red;
lblWaitingForMeterResponse.Visible = false;
btnConnect.Enabled = true;
@@ -73,6 +71,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
SetControlDownloadsLocked();
btnStopFwUpdate.Enabled = false;
btnOpenLutFile.Enabled = true;
+ tbxPcbId.Visible = false;
}
private void FrmLutUpdate_Load(Object sender, EventArgs e)
@@ -185,8 +184,12 @@ namespace Xylem.Common.Ui.GenesisToolBox
Invoke(new Action(() =>
{
- lblConnectPcb.Text = StrPartPcbConnected + _currentGenesis.PcbId;
- lblFwVersion.Text = StrFwVersion + _currentGenesis.FwVersion;
+ lblConnectPcb.Text = StrPartPcbConnected;
+ tbxPcbId.Text = _currentGenesis.PcbId;
+ tbxPcbId.Visible = true;
+ tbxMeterFw.Text = _currentGenesis.FwVersion;
+ tbxMeterMeterSize.Text = _currentGenesis.MeterSize;
+ tbxMeterLutCrc.Text = _currentGenesis.LutCrc;
lblConnectPcb.ForeColor = Color.Green;
CheckUpdateEnabled();
_currentGenesis.Logout();
@@ -280,9 +283,17 @@ namespace Xylem.Common.Ui.GenesisToolBox
ProcessViewControl(false);
SetControlsDownloadIsFinished();
- if (_lutFileSuccessfulWritten)
+ if (!_lutFileSuccessfulWritten)
{
- MessageBoxShow(StrUpdateErrorMessage, @"FAILED",
+ lblLutFileLoadedInfo.ForeColor = Color.Red;
+ lblLutFileLoadedInfo.Text = StrUpdateErrorMessage;
+ var txt = StrUpdateErrorMessage;
+ if (!string.IsNullOrEmpty(_meterLutUpdate?.ErrorMessage))
+ {
+ txt += "\n\n";
+ txt += _meterLutUpdate?.ErrorMessage;
+ }
+ MessageBoxShow(txt, @"FAILED",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
@@ -327,13 +338,14 @@ namespace Xylem.Common.Ui.GenesisToolBox
lblActualProcess.Text = _meterLutUpdate?.GetActualOperation();
var overallProgress = (Int32)(_meterLutUpdate?.OverallProcessCtrPercent ?? 0);
+ if (overallProgress < 0) overallProgress = 0;
barOverallProgressUpdate.Value = overallProgress > 100 ? 100 : overallProgress;
barOverallProgressUpdate.Update();
var singleProgress = (Int32)(_meterLutUpdate?.SingleFileProcessCtrPercent ?? 0);
- if (_meterLutUpdate?.GetLutUpdateStateOperation() != _lastFwUpdateState)
+ if (_meterLutUpdate?.GetActualOperation() != _lastFwUpdateState)
{
- _lastFwUpdateState = _meterLutUpdate?.GetLutUpdateStateOperation();
+ _lastFwUpdateState = _meterLutUpdate?.GetActualOperation();
lblWaitingForMeterResponse.Visible = false;
}
else
@@ -394,15 +406,24 @@ namespace Xylem.Common.Ui.GenesisToolBox
lblLutFileLoadedInfo.ForeColor = Color.Green;
lblLutFileLoadedInfo.Text = StrLutFileValid;
tbxFileCrc.Text = $@"0x{_meterLutUpdate.LutFile.FileCrc:X4}";
- tbxMeterSize.Text = MeterSizeConverter.ConvertMeterSizeEnumToSizeName(_meterLutUpdate.LutFile.MeterSize);
+ tbxFileMeterSize.Text = MeterSizeConverter.ConvertMeterSizeEnumToSizeName(_meterLutUpdate.LutFile.MeterSize);
_lutFileValid = true;
}
else
{
+ var txt = "";
+ if (!string.IsNullOrEmpty(_meterLutUpdate?.ErrorMessage))
+ {
+ txt += _meterLutUpdate?.ErrorMessage;
+ }
+ else
+ {
+ txt = StrLutFileInvalid;
+ }
lblLutFileLoadedInfo.ForeColor = Color.Red;
- lblLutFileLoadedInfo.Text = StrLutFileInvalid;
+ lblLutFileLoadedInfo.Text = txt;
tbxFileCrc.Text = @" --- ";
- tbxMeterSize.Text = @" --- ";
+ tbxFileMeterSize.Text = @" --- ";
_lutFileValid = false;
}
diff --git a/ServiceFwUpdate/Documents/Quick Reference Cordonel Service FW-Update Builder.docx b/ServiceFwUpdate/Documents/Quick Reference Cordonel Service FW-Update Builder.docx
index 5db661dd..7176ac5f 100644
Binary files a/ServiceFwUpdate/Documents/Quick Reference Cordonel Service FW-Update Builder.docx and b/ServiceFwUpdate/Documents/Quick Reference Cordonel Service FW-Update Builder.docx differ