release:6.0.3.71

fix(s7): 打包时pdulength不需要再次减去其他字节量

fix(s7): 打包时尝试连接一次
This commit is contained in:
Diego
2024-07-05 15:07:05 +08:00
parent 90a326f380
commit 558bc3f971
3 changed files with 9 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>6.0.3.71-beta.2</Version>
<Version>6.0.3.71</Version>
</PropertyGroup>
<ItemGroup>

View File

@@ -177,7 +177,7 @@ internal static class PackHelper
while (maxAddress >= minAddress) // 循环,直到最大地址小于最小地址
{
int readLength = siemensS7Net.PduLength == 0 ? 200 : siemensS7Net.PduLength - 28; // 读取长度为PDU长度减去28避免超出限制
int readLength = siemensS7Net.PduLength == 0 ? 200 : siemensS7Net.PduLength; // 读取长度为PDU长度减去28避免超出限制
List<SiemensAddress> tempAddresses = new(); // 临时地址列表用于存储分配给单个数据包的地址

View File

@@ -102,6 +102,13 @@ public partial class SiemensS7Master : ProtocolBase
/// <inheritdoc/>
public override List<T> LoadSourceRead<T>(IEnumerable<IVariable> deviceVariables, int maxPack, int defaultIntervalTime)
{
try
{
this.Channel.Connect();
}
catch
{
}
return PackHelper.LoadSourceRead<T>(this, deviceVariables, maxPack, defaultIntervalTime);
}