This commit is contained in:
Diego
2025-05-23 13:16:57 +08:00
parent 8db9b32ba7
commit 78032656df
3 changed files with 14 additions and 14 deletions

View File

@@ -1,8 +1,8 @@
<Project>
<PropertyGroup>
<PluginVersion>10.6.18</PluginVersion>
<ProPluginVersion>10.6.18</ProPluginVersion>
<PluginVersion>10.6.19</PluginVersion>
<ProPluginVersion>10.6.19</ProPluginVersion>
<AuthenticationVersion>2.1.7</AuthenticationVersion>
</PropertyGroup>

View File

@@ -26,22 +26,22 @@ public class ModbusSlave : DeviceBase, IModbusAddress
/// <summary>
/// 继电器
/// </summary>
private ConcurrentDictionary<byte, ByteBlock> ModbusServer01ByteBlocks = new();
private ConcurrentDictionary<byte, ValueByteBlock> ModbusServer01ByteBlocks = new();
/// <summary>
/// 开关输入
/// </summary>
private ConcurrentDictionary<byte, ByteBlock> ModbusServer02ByteBlocks = new();
private ConcurrentDictionary<byte, ValueByteBlock> ModbusServer02ByteBlocks = new();
/// <summary>
/// 输入寄存器
/// </summary>
private ConcurrentDictionary<byte, ByteBlock> ModbusServer03ByteBlocks = new();
private ConcurrentDictionary<byte, ValueByteBlock> ModbusServer03ByteBlocks = new();
/// <summary>
/// 保持寄存器
/// </summary>
private ConcurrentDictionary<byte, ByteBlock> ModbusServer04ByteBlocks = new();
private ConcurrentDictionary<byte, ValueByteBlock> ModbusServer04ByteBlocks = new();
/// <inheritdoc/>
@@ -187,10 +187,10 @@ public class ModbusSlave : DeviceBase, IModbusAddress
/// <inheritdoc/>
private void Init(ModbusRequest mAddress)
{
ModbusServer01ByteBlocks.GetOrAdd(mAddress.Station, a => new ByteBlock(ushort.MaxValue * 2));
ModbusServer02ByteBlocks.GetOrAdd(mAddress.Station, a => new ByteBlock(ushort.MaxValue * 2));
ModbusServer03ByteBlocks.GetOrAdd(mAddress.Station, a => new ByteBlock(ushort.MaxValue * 2));
ModbusServer04ByteBlocks.GetOrAdd(mAddress.Station, a => new ByteBlock(ushort.MaxValue * 2));
ModbusServer01ByteBlocks.GetOrAdd(mAddress.Station, a => new ValueByteBlock(new byte[ushort.MaxValue * 2]));
ModbusServer02ByteBlocks.GetOrAdd(mAddress.Station, a => new ValueByteBlock(new byte[ushort.MaxValue * 2]));
ModbusServer03ByteBlocks.GetOrAdd(mAddress.Station, a => new ValueByteBlock(new byte[ushort.MaxValue * 2]));
ModbusServer04ByteBlocks.GetOrAdd(mAddress.Station, a => new ValueByteBlock(new byte[ushort.MaxValue * 2]));
}
public override Action<IPluginManager> ConfigurePlugins(TouchSocketConfig config)
@@ -416,7 +416,7 @@ public class ModbusSlave : DeviceBase, IModbusAddress
var data = ModbusRequest(modbusRequest, true);
if (data.IsSuccess)
{
ByteBlock valueByteBlock = new(1024);
ValueByteBlock valueByteBlock = new(1024);
try
{
if (modbusRtu)
@@ -560,7 +560,7 @@ public class ModbusSlave : DeviceBase, IModbusAddress
private async Task WriteError(bool modbusRtu, IClientChannel client, ReadOnlyMemory<byte> bytes, ReceivedDataEventArgs e)
{
ByteBlock valueByteBlock = new(20);
ValueByteBlock valueByteBlock = new(20);
try
{
if (modbusRtu)
@@ -587,7 +587,7 @@ public class ModbusSlave : DeviceBase, IModbusAddress
private async Task WriteSuccess(bool modbusRtu, IClientChannel client, ReadOnlyMemory<byte> bytes, ReceivedDataEventArgs e)
{
ByteBlock valueByteBlock = new(20);
ValueByteBlock valueByteBlock = new(20);
try
{
if (modbusRtu)

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>10.6.18</Version>
<Version>10.6.19</Version>
</PropertyGroup>
<ItemGroup>