ota_update script: nicer progress display

This commit is contained in:
Thomas Kolb 2019-12-02 20:56:16 +01:00
parent 1c899c1f24
commit 49c39184b9

View file

@ -66,6 +66,8 @@ if not success:
print("Failed.") print("Failed.")
exit(1) exit(1)
print() # for proper progress display
with open(filename, "rb") as binfile: with open(filename, "rb") as binfile:
filesize = os.stat(filename).st_size filesize = os.stat(filename).st_size
@ -80,7 +82,7 @@ with open(filename, "rb") as binfile:
s.send(data) s.send(data)
sent_bytes += len(data) sent_bytes += len(data)
print(f"Sent {sent_bytes} of {filesize} bytes.") print(f"\rSent {sent_bytes} of {filesize} bytes.")
success, message = readMessage(s) success, message = readMessage(s)
print(f"Server message: {message}") print(f"Server message: {message}")