From 93f23c69983a50ebf355a45b810107132b60a80b Mon Sep 17 00:00:00 2001 From: luosheng Date: Tue, 9 May 2023 10:57:44 +0800 Subject: [PATCH] RTU length calc change --- Modbus.Net/Modbus.Net.Modbus/ModbusRtuProtocolLinker.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modbus.Net/Modbus.Net.Modbus/ModbusRtuProtocolLinker.cs b/Modbus.Net/Modbus.Net.Modbus/ModbusRtuProtocolLinker.cs index 2e6f05e..859f32e 100644 --- a/Modbus.Net/Modbus.Net.Modbus/ModbusRtuProtocolLinker.cs +++ b/Modbus.Net/Modbus.Net.Modbus/ModbusRtuProtocolLinker.cs @@ -20,7 +20,9 @@ namespace Modbus.Net.Modbus lengthCalc: content => { if (content[1] > 128) return 5; - else if (content[1] == 5 || content[1] == 6 || content[1] == 15 || content[1] == 16 || content[1] == 21) return 8; + else if (content[1] == 5 || content[1] == 6 || content[1] == 8 || content[1] == 11 || content[1] == 15 || content[1] == 16) return 8; + else if (content[1] == 7) return 5; + else if (content[1] == 22) return 10; else return DuplicateWithCount.GetDuplcateFunc(new List { 2 }, 5).Invoke(content); }, checkRightFunc: ContentCheck.Crc16CheckRight,