diff --git a/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs b/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs index d23b6c01..9a7a76d2 100644 --- a/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs +++ b/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs @@ -1,5 +1,6 @@ using Logic.ProductionToProductMapper.Cordonel; using Newtonsoft.Json; +using NLog; using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -14,7 +15,6 @@ using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Timers; -using NLog; using Xylem.Common.CommonCore.Configuration; using Xylem.Common.CommonCore.Consts; using Xylem.Common.CommonCore.ThreadWatcher; @@ -49,6 +49,7 @@ using Xylem.Common.Metrology.Measurements; using Xylem.Common.Metrology.Measurements.Consts; using Xylem.Common.Utils.Logging; using Access = Xylem.Common.Hardware.WaterMeter.Genesis.Registers.Access; +using Register = Xylem.Common.Hardware.WaterMeter.Genesis.Registers.Register; using Timer = System.Timers.Timer; namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore @@ -1384,9 +1385,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore /// /// - Removed the optional leading "B" or "R" on strVersion input to create the fwVersion. /// - /// - /// - Masked out the marker for "B" in msb input to create the fwVersion. - /// public static String BuildFlexnetFwVersion(out UInt32 fwVersion, String strVersion, Byte? msb = null, Byte? lsb = null) { @@ -1406,8 +1404,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore minor = (Int32)(msb & 0x0F); builtMajor = (Int32)((lsb & 0xF0) >> 4); builtMinor = (Int32)(lsb & 0x0F); - // mask out the "B" marker 0111 1111 - fwVersion = (UInt32)(((msb & 0x7F) << 8) + lsb); + fwVersion = (UInt32)(((msb & 0xFF) << 8) + lsb); } else if (!string.IsNullOrEmpty(strVersion)) { @@ -1720,6 +1717,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore /// AppId 256, which exceeds the byte range as this isn't a real application, but will be used to identify /// the interface (configuration.json) version. /// + /// + /// - Mask out the 'B' marker (0x8000) as 'configuration.json' states only the 'R' version. + /// protected virtual void ReadMeterFirmwareAndAssignRegisters() { // Avoid overwriting of list if this already exits @@ -1749,11 +1749,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore InterfaceVersion = BuildFwVersionStringFromDec(meterApp.AppVersion); // Build the max supported versions for EMEA and NA to check the supported FW if (Region.Equals("EMEA")) - InterfaceMaxFwVersion = BuildFlexnetFwVersion(out interfaceMaxEmeaVersion, + { + InterfaceMaxFwVersion = BuildFlexnetFwVersion(out interfaceMaxEmeaVersion, meterApp.InterfaceMaxEmeaVersion); + } if (Region.Equals("NA")) - InterfaceMaxFwVersion = BuildFlexnetFwVersion(out interfaceMaxNaVersion, + { + InterfaceMaxFwVersion = BuildFlexnetFwVersion(out interfaceMaxNaVersion, meterApp.InterfaceMaxNaVersion); + } continue; } @@ -1778,7 +1782,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore FwVersion = BuildFlexnetFwVersion(out readFwVersion, null, readFwVersionBytes[1], readFwVersionBytes[0]); versionString = FwVersion; - InstalledFwVersion = readFwVersion; + // Mask out the 'B' marker (0x8000) as 'configuration.json' states only the 'R' version + InstalledFwVersion = readFwVersion & 0x7FFF; } else {