mirror of
https://gitee.com/iioter/iotgateway.git
synced 2024-11-29 18:28:09 +08:00
Merge branch 'master' of https://gitee.com/iioter/iotgateway
This commit is contained in:
commit
a531ae3359
@ -631,7 +631,9 @@ namespace PLC.ModBusMaster
|
|||||||
break;
|
break;
|
||||||
case DataTypeEnum.Float:
|
case DataTypeEnum.Float:
|
||||||
var f = float.Parse(ioArg.Value.ToString());
|
var f = float.Parse(ioArg.Value.ToString());
|
||||||
ModBusDataConvert.SetReal(shortArray, 0, f);
|
var fValue = BitConverter.SingleToUInt32Bits(f);
|
||||||
|
shortArray[1] = (ushort)(fValue & 0xffff);
|
||||||
|
shortArray[0] = (ushort)(fValue >> 16 & 0xffff);
|
||||||
toWriteArray = ChangeBuffersOrder(shortArray, ioArg.EndianType);
|
toWriteArray = ChangeBuffersOrder(shortArray, ioArg.EndianType);
|
||||||
await _master.WriteMultipleRegistersAsync(slaveAddress, address, toWriteArray);
|
await _master.WriteMultipleRegistersAsync(slaveAddress, address, toWriteArray);
|
||||||
break;
|
break;
|
||||||
|
@ -289,7 +289,8 @@ namespace Plugin
|
|||||||
{
|
{
|
||||||
Address = deviceVariable.DeviceAddress,
|
Address = deviceVariable.DeviceAddress,
|
||||||
Value = para.Value,
|
Value = para.Value,
|
||||||
ValueType = deviceVariable.DataType
|
ValueType = deviceVariable.DataType,
|
||||||
|
EndianType = deviceVariable.EndianType
|
||||||
};
|
};
|
||||||
var writeResponse = Driver
|
var writeResponse = Driver
|
||||||
.WriteAsync(e.RequestId, deviceVariable.Method, ioArgModel).Result;
|
.WriteAsync(e.RequestId, deviceVariable.Method, ioArgModel).Result;
|
||||||
|
Loading…
Reference in New Issue
Block a user