Commit 5e324aaea2fec08283f30efc6a9f42d40e207d4f
Merge branch 'master' into 'master_dev'
perf: modbus_rtu 16位有符号无符号计算值时,对于整数不做特殊处理,只乘以缩放因子 See merge request yunteng/thingskit!408
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 | } |