Commit 78201e0a7035e4938ff0ba83127776543c49acfe
1 parent
d7a68651
perf: modbus_rtu 16位有符号无符号计算值时,对于整数不做特殊处理,只乘以缩放因子
Showing
1 changed file
with
1 additions
and
1 deletions
@@ -254,7 +254,7 @@ public class HexConvertUtils { | @@ -254,7 +254,7 @@ public class HexConvertUtils { | ||
254 | case UINT16_BA: | 254 | case UINT16_BA: |
255 | hex = convertHexOrder(hex, dataTypeEnum); | 255 | hex = convertHexOrder(hex, dataTypeEnum); |
256 | if((int16OrUint16ToShort(hex) * scaleFactor) % 1 == FastIotConstants.MagicNumber.ZERO){ | 256 | if((int16OrUint16ToShort(hex) * scaleFactor) % 1 == FastIotConstants.MagicNumber.ZERO){ |
257 | - value = int16OrUint16ToShort(hex); | 257 | + value = (int)(int16OrUint16ToShort(hex) * scaleFactor); |
258 | }else{ | 258 | }else{ |
259 | value = intFormat.format(int16OrUint16ToShort(hex) * scaleFactor); | 259 | value = intFormat.format(int16OrUint16ToShort(hex) * scaleFactor); |
260 | } | 260 | } |