Alter Endian from enum to partial class

This commit is contained in:
luosheng
2023-06-27 19:33:08 +08:00
parent 7707ca7719
commit 32eb4a9afd
14 changed files with 164 additions and 106 deletions

View File

@@ -55,7 +55,7 @@ namespace AnyType.Controllers
Value = 0,
Type = unitValue.DataType.Name
};
var machine = new ModbusMachine("1", ModbusType.Tcp, "10.10.18.251:502", addressUnits, true, 2, 0);
var machine = new ModbusMachine("1", ModbusType.Tcp, "10.10.18.251:502", addressUnits, true, 2, 0, Endian.BigEndianLsb);
//启动任务
await MachineJobSchedulerCreator.CreateScheduler("Trigger1", -1, 1).Result.From(machine.Id, machine, MachineDataType.CommunicationTag).Result.Query("Query1",
returnValues =>

View File

@@ -30,7 +30,7 @@ namespace CrossLamp.Controllers
{
if (_utility == null)
{
_utility = new ModbusUtility(ModbusType.Tcp, "10.10.18.251", 2, 0);
_utility = new ModbusUtility(ModbusType.Tcp, "10.10.18.251", 2, 0, Endian.BigEndianLsb);
await _utility.ConnectAsync();
}
Lamp light = new Lamp();

View File

@@ -41,7 +41,7 @@ namespace TripleAdd.Controllers
{
if (utility == null)
{
utility = new ModbusUtility(ModbusType.Tcp, "10.10.18.251", 2, 0);
utility = new ModbusUtility(ModbusType.Tcp, "10.10.18.251", 2, 0, Endian.BigEndianLsb);
utility.AddressTranslator = new AddressTranslatorModbus();
await utility.ConnectAsync();
}
@@ -60,7 +60,7 @@ namespace TripleAdd.Controllers
new AddressUnit() {Id = "2", Area = "4X", Address = 2, CommunicationTag = "Add2", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0},
new AddressUnit() {Id = "3", Area = "4X", Address = 3, CommunicationTag = "Add3", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0},
new AddressUnit() {Id = "4", Area = "4X", Address = 4, CommunicationTag = "Ans", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0},
}, 2, 0);
}, 2, 0, Endian.BigEndianLsb);
machine.AddressCombiner = new AddressCombinerContinus<string>(machine.AddressTranslator, 100000);
machine.AddressCombinerSet = new AddressCombinerContinus<string>(machine.AddressTranslator, 100000);
}