[bugfix] 修复获取float型参数结果为0

This commit is contained in:
cuijingwei@brisonus.com 2025-02-22 16:52:30 +08:00
parent 083e1d9e05
commit 0afe78b1c2

View File

@ -78,7 +78,7 @@ class ModbusController:
bytes_value = struct.pack('<HH', *swapped_registers)
# Convert to float32 little endian byte-swap
# For byte-swap, we need to swap the registers and then interpret as little endian
if param.data_type == "float32":
if param.data_type == "float":
return struct.unpack('<f', bytes_value)[0]
elif param.data_type == "int32_t":