Hi,
First, I would like to say that this python library is quite usefull to me ! Thanks a lot for the contributors and the maintainer. The original snap7 library is also awesome !
During one dev, I couldn't use the util.set_dint and the util.set_udint methods properly.
After code check, it appears that the return statement is missing in some util.set methods.
Original code :
def set_dint(bytearray_: bytearray, byte_index: int, dint: int) -> None:
dint = int(dint)
_bytes = struct.unpack("4B", struct.pack(">i", dint))
for i, b in enumerate(_bytes):
bytearray_[byte_index + i] = b
Working code :
def set_dint(bytearray_: bytearray, byte_index: int, dint: int) -> bytearray:
dint = int(dint)
_bytes = struct.unpack("4B", struct.pack(">i", dint))
for i, b in enumerate(_bytes):
bytearray_[byte_index + i] = b
return bytearray_
If needed, I can propose a pull request !
Camille
Hi,
First, I would like to say that this python library is quite usefull to me ! Thanks a lot for the contributors and the maintainer. The original snap7 library is also awesome !
During one dev, I couldn't use the
util.set_dintand theutil.set_udintmethods properly.After code check, it appears that the
returnstatement is missing in someutil.setmethods.Original code :
Working code :
If needed, I can propose a pull request !
Camille