Currently you've to configure whether values are signed or unsigned.
The following code results in an IllegalValueError:
conf.SIGNED_VALUES = False
with tcp.Client() as c:
# Raises IllegalValueError
c.write_single_register(slave_id=1, address=1, value=-5)
I new option should be introducted: conf.DYNAMIC_SIGNESS. This value, False by default, allows a a client to determine the type character based on the signess of the value that is being written.
conf.DYNAMIC_TYPE_CHAR = True
with tcp.Client() as c:
# In modbus.functions this call is done: struct.pack('>h', -5)
c.write_single_register(slave_id=1, address=1, value=-5)
# In umodbus.functions this call is done: struct.pack('>H', 5)
c.write_single_register(slave_id=1, address=1, value=-5)
Currently you've to configure whether values are signed or unsigned. The following code results in an
IllegalValueError
:I new option should be introducted:
conf.DYNAMIC_SIGNESS
. This value,False
by default, allows a a client to determine the type character based on the signess of the value that is being written.