Fix a bug in AddressCombinerNumericJump

This commit is contained in:
parallelbgls
2017-05-23 11:22:27 +08:00
parent 88cd361a5a
commit e941f7eafb

View File

@@ -351,7 +351,8 @@ namespace Modbus.Net
{ {
if (orderedGap.GapNumber <= 0) continue; if (orderedGap.GapNumber <= 0) continue;
var nowAddress = orderedGap.EndUnit; var nowAddress = orderedGap.EndUnit;
var index = continusAddresses.IndexOf(nowAddress); var index = continusAddresses.FindIndex(p=>p.Area == nowAddress.Area && p.Address == nowAddress.Address && p.SubAddress == nowAddress.SubAddress);
nowAddress = continusAddresses[index];
index--; index--;
var preAddress = continusAddresses[index]; var preAddress = continusAddresses[index];
if (nowAddress.GetCount * BigEndianValueHelper.Instance.ByteLength[nowAddress.DataType.FullName] + if (nowAddress.GetCount * BigEndianValueHelper.Instance.ByteLength[nowAddress.DataType.FullName] +