From bedf8c9b284ccb9d9918d742ec89997c201f1602 Mon Sep 17 00:00:00 2001 From: parallelbgls Date: Tue, 23 May 2017 11:22:27 +0800 Subject: [PATCH] Fix a bug in AddressCombinerNumericJump --- Modbus.Net/src/Base.Common/AddressCombiner.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modbus.Net/src/Base.Common/AddressCombiner.cs b/Modbus.Net/src/Base.Common/AddressCombiner.cs index 305fb93..5c66dde 100644 --- a/Modbus.Net/src/Base.Common/AddressCombiner.cs +++ b/Modbus.Net/src/Base.Common/AddressCombiner.cs @@ -351,7 +351,8 @@ namespace Modbus.Net { if (orderedGap.GapNumber <= 0) continue; 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--; var preAddress = continusAddresses[index]; if (nowAddress.GetCount * BigEndianValueHelper.Instance.ByteLength[nowAddress.DataType.FullName] +