CUST: - register restorer compare enabled with new "statictype":"approximate", new configuration.json B14.07 needed
This commit is contained in:
parent
1c0332e7df
commit
cab26faefd
@ -383,6 +383,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
/// <remarks date="2023-Nov-20" author="Thomas Wiedebusch">
|
||||
/// - Initial.
|
||||
/// </remarks>
|
||||
/// <remarks date="2023-Nov-27" author="Thomas Wiedebusch">
|
||||
/// - Compare registers reactivated based on new interface (configuration.json) with new
|
||||
/// "StaticType": “approximate”.
|
||||
/// </remarks>
|
||||
public Boolean CompareRegisters()
|
||||
{
|
||||
if (_pcbIdFinalRegisterRead != _pcbIdInitialRegisterRead ||
|
||||
@ -425,17 +429,35 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
var strRequiredRegisterValue = "";
|
||||
try
|
||||
{
|
||||
var isIdentical = true;
|
||||
for (var c = 0; c < dataSize; c++)
|
||||
var isApproximated = false;
|
||||
var isIdentical = false;
|
||||
if (regDef.RegisterDetail.StaticType == StaticType.ReadBackApproximated)
|
||||
{
|
||||
if (restorableRawRegister[c] == finalReadRawRegister[c]) continue;
|
||||
isIdentical = false;
|
||||
break;
|
||||
var restoreValue = RegisterConverter.ConvertTo<UInt32>(restorableRawRegister);
|
||||
var finalValue = RegisterConverter.ConvertTo<UInt32>(finalReadRawRegister);
|
||||
|
||||
// Check limited to +/- 3
|
||||
if (restoreValue - 3 <= finalValue && restoreValue + 3 >= finalValue)
|
||||
{
|
||||
isApproximated = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var c = 0; c < dataSize; c++)
|
||||
{
|
||||
if (restorableRawRegister[c] != finalReadRawRegister[c])
|
||||
{
|
||||
isIdentical = false;
|
||||
break;
|
||||
}
|
||||
isIdentical = true;
|
||||
}
|
||||
}
|
||||
// convert register content to text with raw and converted value depending on data type
|
||||
strRequiredRegisterValue =
|
||||
RegisterConverter.GetRegisterContentText(regDef, restorableRawRegister);
|
||||
if (finalReadRawRegister != null && isIdentical)
|
||||
if (finalReadRawRegister != null && (isIdentical || isApproximated))
|
||||
{
|
||||
strRequiredRegisterValue += $" - {Resources.StrRegisterCompareSucceeded}";
|
||||
}
|
||||
|
||||
@ -26,19 +26,25 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes
|
||||
/// <summary>
|
||||
/// Static type to define restore capability
|
||||
/// </summary>
|
||||
private const String RestoreRequired = "static";
|
||||
public const String RestoreRequired = "static";
|
||||
|
||||
/// <summary>
|
||||
/// Static type approximate informs that the read back value may be not identical
|
||||
/// to the written value and is approximated.
|
||||
/// </summary>
|
||||
public const String ReadBackApproximated = "approximate";
|
||||
|
||||
/// <summary>
|
||||
/// Denied restore capability
|
||||
/// </summary>
|
||||
// ReSharper disable once UnusedMember.Local
|
||||
private const String RestoreDenied = "dynamic";
|
||||
public const String RestoreDenied = "dynamic";
|
||||
|
||||
/// <summary>
|
||||
/// Unpredictable restore capability
|
||||
/// </summary>
|
||||
// ReSharper disable once UnusedMember.Local
|
||||
private const String RestoreUnpredictable = "infrequentlyupdated";
|
||||
public const String RestoreUnpredictable = "infrequentlyupdated";
|
||||
|
||||
/// <summary>
|
||||
/// Check restore capability
|
||||
@ -46,7 +52,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes
|
||||
/// <returns>true if restore required</returns>
|
||||
public Boolean CheckRestoreCapability()
|
||||
{
|
||||
return StaticTypeValue == RestoreRequired;
|
||||
return StaticTypeValue == RestoreRequired || StaticTypeValue == ReadBackApproximated;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -323,6 +323,10 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
/// <remarks date="2023-Nov-22" author="Thomas Wiedebusch">
|
||||
/// - Restore meter files and compare registers removed for this release.
|
||||
/// </remarks>
|
||||
/// <remarks date="2023-Nov-27" author="Thomas Wiedebusch">
|
||||
/// - Compare registers reactivated based on new interface (configuration.json) with new
|
||||
/// "StaticType": “approximate”.
|
||||
/// </remarks>
|
||||
private void FwUpdateSwStateMachine()
|
||||
{
|
||||
while (!_processToken.IsCancellationRequested)
|
||||
@ -457,8 +461,7 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
break;
|
||||
|
||||
case ProcessState.CompareRegisters:
|
||||
//TODO THW ReadRegisters(GetNextProcessState(_processState, _stateSequencePrepareMeterRelease));
|
||||
_processState = GetNextProcessState(_processState, _stateSequencePrepareMeterRelease);
|
||||
ReadRegisters(GetNextProcessState(_processState, _stateSequencePrepareMeterRelease));
|
||||
break;
|
||||
|
||||
case ProcessState.RestorePasswordFile:
|
||||
|
||||
@ -656,7 +656,7 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Installed LUT is equal to required LUT..
|
||||
/// Looks up a localized string similar to Installed LUT is equal to required..
|
||||
/// </summary>
|
||||
internal static string StrLutFileCompareSucceeded {
|
||||
get {
|
||||
@ -701,7 +701,7 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ERROR: LUT is not in FW updae safe!.
|
||||
/// Looks up a localized string similar to ERROR: LUT is not in FW update safe!.
|
||||
/// </summary>
|
||||
internal static string StrLutFileNotDelivered {
|
||||
get {
|
||||
|
||||
@ -620,13 +620,13 @@
|
||||
<value>ERROR: Installed LUT is unequal to required!</value>
|
||||
</data>
|
||||
<data name="StrLutFileCompareSucceeded" xml:space="preserve">
|
||||
<value>Installed LUT is equal to required LUT.</value>
|
||||
<value>Installed LUT is equal to required.</value>
|
||||
</data>
|
||||
<data name="StrLutFileFromSafeInvalid" xml:space="preserve">
|
||||
<value>ERROR: LUT from FW update safe invalid!</value>
|
||||
</data>
|
||||
<data name="StrLutFileNotDelivered" xml:space="preserve">
|
||||
<value>ERROR: LUT is not in FW updae safe!</value>
|
||||
<value>ERROR: LUT is not in FW update safe!</value>
|
||||
</data>
|
||||
<data name="StrLutFileReadoutFailed" xml:space="preserve">
|
||||
<value>ERROR: LUT readout failed!</value>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user