Skip to content

Commit

Permalink
Update client.full_upload() (#158)
Browse files Browse the repository at this point in the history
* Add get/set date & time

New function:
set_plc_datetime
get_plc_datetime

* Add get_plc_datetime and set_plc_datetime

* full_upload1

* full_upload1

Before change following code would have failed:
data, size = client.full_upload("FC", 1)
client.download(data=data, block_num=1)

Co-authored-by: Gijs Molenaar <[email protected]>
  • Loading branch information
Lamelynx and gijzelaerr authored May 19, 2020
1 parent 30f15a4 commit f82c051
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions snap7/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def full_upload(self, _type, block_num):
block_num, byref(_buffer),
byref(size))
check_error(result, context="client")
return bytearray(_buffer), size.value
return bytearray(_buffer)[:size.value], size.value

def upload(self, block_num):
"""
Expand Down Expand Up @@ -607,7 +607,7 @@ def get_plc_datetime(self):
second = buffer[0]
)

@error_wrap
@error_wrap
def set_plc_datetime(self, dt):
"""
Set date and time in PLC
Expand Down

0 comments on commit f82c051

Please sign in to comment.