Improved LUT update process speed
This commit is contained in:
@@ -70,10 +70,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
||||
private const Int32 RegisterWriteRetries = 0;
|
||||
|
||||
//update reties for files
|
||||
private const Int32 FileWriteRetries = 0;
|
||||
private const Int32 FileWriteRetries = 1;
|
||||
|
||||
//retry of entire update procedure
|
||||
private const Int32 UpdateProcedureRetries = 0;
|
||||
private const Int32 UpdateProcedureRetries = 1;
|
||||
|
||||
//threshold to increase the file write timing
|
||||
private const Int32 IncreaseTimeoutUpdateProcedureRetries = 4;
|
||||
@@ -669,7 +669,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
||||
/// <remarks date="2022-Mar-04" author="Thomas Wiedebusch">
|
||||
/// - Initial
|
||||
/// </remarks>
|
||||
private Boolean ReadMeterFilesDrive1()
|
||||
private Boolean ListMeterFilesDrive1()
|
||||
{
|
||||
// logout and re-login to clear all ongoing processes and clear the Genesis buffers
|
||||
ReestablishMeterFileSystem();
|
||||
@@ -679,9 +679,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
||||
_meterFilesDrive1 = new List<String>();
|
||||
}
|
||||
_meterFilesDrive1.Clear();
|
||||
Thread.Sleep(2000);
|
||||
|
||||
OnProcessUpdate?.Invoke(this, new ProcessExecEventArgs("Read meter files drive 1"));
|
||||
OnProcessUpdate?.Invoke(this, new ProcessExecEventArgs("List meter files drive 1"));
|
||||
if (!_meterFile.ReadMeterFileCatalog(out var meterFilesDrive1, MeterFile.StrMeterDrive1,
|
||||
MeterFile.WildcardAll.ToString()))
|
||||
return false;
|
||||
@@ -703,35 +702,35 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
||||
/// <remarks date="2022-Mar-04" author="Thomas Wiedebusch">
|
||||
/// - Initial
|
||||
/// </remarks>
|
||||
private Boolean EraseFileAndVerifyErasure(String fileDriveName)
|
||||
private Boolean EraseFile(String fileDriveName)
|
||||
{
|
||||
OnProcessUpdate?.Invoke(this, new ProcessExecEventArgs($"Erasing {fileDriveName}"));
|
||||
var returnValue = _meterFile.UnlockEraseWriteMeterFile(fileDriveName);
|
||||
// erase returns always TRUE, even if the erasure failed! Check with catalogue
|
||||
_meterFile.EraseMeterFile(fileDriveName);
|
||||
|
||||
if (ReadMeterFilesDrive1())
|
||||
{
|
||||
if (_meterFilesDrive1.Contains(fileDriveName))
|
||||
{
|
||||
returnValue = false;
|
||||
var txt = $"Failed to erase {fileDriveName}!";
|
||||
ErrorMessage = txt;
|
||||
OnProcessUpdate?.Invoke(this, new ProcessExecEventArgs(txt));
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorMessage = "";
|
||||
OnProcessUpdate?.Invoke(this, new ProcessExecEventArgs($"Successfully erased {fileDriveName}"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = false;
|
||||
const String txt = "Meter files read error!";
|
||||
ErrorMessage = txt;
|
||||
OnProcessUpdate?.Invoke(this, new ProcessExecEventArgs(txt));
|
||||
}
|
||||
//if (ListMeterFilesDrive1())
|
||||
//{
|
||||
// if (_meterFilesDrive1.Contains(fileDriveName))
|
||||
// {
|
||||
// returnValue = false;
|
||||
// var txt = $"Failed to erase {fileDriveName}!";
|
||||
// ErrorMessage = txt;
|
||||
// OnProcessUpdate?.Invoke(this, new ProcessExecEventArgs(txt));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorMessage = "";
|
||||
// OnProcessUpdate?.Invoke(this, new ProcessExecEventArgs($"Successfully erased {fileDriveName}"));
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// returnValue = false;
|
||||
// const String txt = "Meter files read error!";
|
||||
// ErrorMessage = txt;
|
||||
// OnProcessUpdate?.Invoke(this, new ProcessExecEventArgs(txt));
|
||||
//}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -758,11 +757,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
||||
var filesToErase = new[] { StrLutMeterFileName, StrLutBackupMeterFileName };
|
||||
|
||||
// read all files which are already installed
|
||||
_actualOperation = "Read installed meter files drive 1";
|
||||
_actualOperation = "Catalogue installed meter files drive 1";
|
||||
_operationCtr++;
|
||||
|
||||
// read files on drive 1 to verify the LUT installation
|
||||
if (ReadMeterFilesDrive1())
|
||||
if (ListMeterFilesDrive1())
|
||||
{
|
||||
foreach (var fileToErase in filesToErase)
|
||||
{
|
||||
@@ -771,7 +770,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
||||
|
||||
_operationCtr++;
|
||||
_actualOperation = $"Erase {fileToErase}";
|
||||
if (EraseFileAndVerifyErasure(fileToErase))
|
||||
if (EraseFile(fileToErase))
|
||||
{
|
||||
ErrorMessage = "";
|
||||
continue;
|
||||
@@ -810,7 +809,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
||||
return false;
|
||||
|
||||
//set extended timeout for trigger upgrade response delay
|
||||
_genesisMeter.TransmitProtocol.SetResponseTimeout(10000);
|
||||
_genesisMeter.TransmitProtocol.SetResponseTimeout(1000);
|
||||
var returnValue = true;
|
||||
|
||||
//write LUT files and retry if not successful
|
||||
@@ -845,7 +844,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
||||
// read all files on drive 1
|
||||
_operationCtr++;
|
||||
|
||||
if (ReadMeterFilesDrive1())
|
||||
if (ListMeterFilesDrive1())
|
||||
{
|
||||
foreach (var checkInstalledFile in filesToDownload)
|
||||
{
|
||||
@@ -896,7 +895,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
||||
return false;
|
||||
|
||||
//set extended timeout for trigger upgrade response delay
|
||||
_genesisMeter.TransmitProtocol.SetResponseTimeout(10000);
|
||||
_genesisMeter.TransmitProtocol.SetResponseTimeout(1000);
|
||||
var returnValue = true;
|
||||
|
||||
//write LUT files and retry if not successful
|
||||
|
||||
Reference in New Issue
Block a user