s7 修改解析 返回码 顺序

This commit is contained in:
Kimdiego2098
2024-04-10 15:20:18 +08:00
parent 99d174906a
commit 05c19a32ea

View File

@@ -57,6 +57,19 @@ internal partial class SiemensHelper
Content2 = FilterResult.Cache
};
}
if (content.Length >= 22)
{
//添加返回代码校验
if (content[21] != 0xff)
{
return new($"PLC返回错误返回代码{content[21].ToString("X2")}")
{
Content2 = FilterResult.Success
};
}
}
if (content.Length < 25 + content[20])
{
return new($"长度不足")
@@ -64,14 +77,6 @@ internal partial class SiemensHelper
Content2 = FilterResult.Cache
};
}
//添加返回代码校验
if (content[21] != 0xff)
{
return new($"PLC返回错误返回代码{content[21].ToString("X2")}")
{
Content2 = FilterResult.Success
};
}
for (int index = 0; index < itemLen; index++)
{