-
-
Notifications
You must be signed in to change notification settings - Fork 258
Open
Description
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
lupaulus
Metadata
Metadata
Assignees
Labels
No labels