GTB 2.2.1
- GenesisMeter: StoreAllConfigurations corrected, stores all calibrations and configurations, avoids read back of store-configuration on SENSUSRADIO as this returns NULL, - FwUpdate: Executes StoreAllConfigurations before FwUpdate
This commit is contained in:
@@ -2050,43 +2050,64 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
}
|
||||
|
||||
|
||||
public Boolean StoreAllApps()
|
||||
/// <summary>
|
||||
/// Executes all StoreConfiguration and StoreCalibration for each application.
|
||||
/// </summary>
|
||||
/// <returns>true if all configurations are stored</returns>
|
||||
/// <remarks date="2019-Apr-06" author="Roland Drabesch">
|
||||
/// - Initial
|
||||
/// </remarks>
|
||||
/// <remarks date="2022-Apr-21" author="Thomas Wiedebusch">
|
||||
/// - Corrected logic to enter write and read loop,
|
||||
/// - Removed SENSUSRADIO from read check as it returns NULL on read of StoreConfiguration.
|
||||
/// </remarks>
|
||||
public Boolean StoreAllConfigurations()
|
||||
{
|
||||
var overallResult = true;
|
||||
var retryLeft = 3;
|
||||
foreach (var a in _configRegister.MeterRegisterDic.Where(a => a.Key.RegisterName.ToLower() == "storeconfiguration"))
|
||||
foreach (var a in _configRegister.MeterRegisterDic.Where(a =>
|
||||
a.Key.RegisterName.ToLower() == "storeconfiguration" ||
|
||||
a.Key.RegisterName.ToLower() == "storecalibration"))
|
||||
{
|
||||
var done = false;
|
||||
while (retryLeft > 0 && done)
|
||||
//retries for each register access
|
||||
var retryLeft = 3;
|
||||
|
||||
while (retryLeft > 0 && !done)
|
||||
{
|
||||
var result = WriteRegister(a.Key.GetIdent(), 1, true, false);
|
||||
var result = WriteRegister(a.Key.GetIdent(), 1);
|
||||
if (!result)
|
||||
{
|
||||
retryLeft = retryLeft - 1;
|
||||
retryLeft -= 1;
|
||||
if (retryLeft == 0)
|
||||
{
|
||||
overallResult = false;
|
||||
|
||||
}
|
||||
continue;
|
||||
|
||||
}
|
||||
Thread.Sleep(100);
|
||||
var resultRead = ReadRegister(a.Key.GetIdent());
|
||||
if (resultRead == null || !resultRead.ToList().All(ra => ra == 0x00))
|
||||
if (a.Key.AppName == "SENSUSRADIO")
|
||||
{
|
||||
retryLeft = retryLeft - 1;
|
||||
done = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
var resultRead = ReadRegister(a.Key.GetIdent());
|
||||
if (resultRead == null || resultRead.ToList().Any(ra => ra != 0x00))
|
||||
{
|
||||
retryLeft -= 1;
|
||||
if (retryLeft == 0)
|
||||
{
|
||||
overallResult = false;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
done = true;
|
||||
Thread.Sleep(100);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return overallResult;
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
if (_currentGenesis == null && _pcbIdPostUpdate != _pcbIdPreUpdate) return false;
|
||||
|
||||
// write store configuration to all applications
|
||||
_currentGenesis?.StoreAllApps();
|
||||
_currentGenesis?.StoreAllConfigurations();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -957,6 +957,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
||||
/// <remarks date="2020-Dec-19" author="Thomas Wiedebusch">
|
||||
/// - Set file write timeout to default.
|
||||
/// </remarks>
|
||||
/// <remarks date="2022-Apr-21" author="Thomas Wiedebusch">
|
||||
/// - Store all configurations before the update.
|
||||
/// </remarks>
|
||||
public Boolean UpdatePreparation()
|
||||
{
|
||||
_actualOperation = "";
|
||||
@@ -989,6 +992,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
||||
_genesisMeter.WriteRegister(item.Key, item.Value);
|
||||
}
|
||||
|
||||
//store all configuration parameters
|
||||
if (!_genesisMeter.StoreAllConfigurations()) return false;
|
||||
|
||||
//remove the update stop action
|
||||
StopUpdateProcess = false;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user