1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 20:49:49 +04:00

[FL-3351] github: re-enabled f18 build (#2743)

* github: re-enabled f18 build
* scripts: storage: better transfer logging
* Fix PVS warnings

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
hedger
2023-06-08 10:16:01 +04:00
committed by GitHub
parent c186d2b0cc
commit 3226254876
7 changed files with 28 additions and 24 deletions

View File

@@ -257,12 +257,12 @@ class FlipperStorage:
self.read.until(self.CLI_PROMPT)
ftell = file.tell()
percent = str(math.ceil(ftell / filesize * 100))
total_chunks = str(math.ceil(filesize / buffer_size))
current_chunk = str(math.ceil(ftell / buffer_size))
percent = math.ceil(ftell / filesize * 100)
total_chunks = math.ceil(filesize / buffer_size)
current_chunk = math.ceil(ftell / buffer_size)
approx_speed = ftell / (time.time() - start_time + 0.0001)
sys.stdout.write(
f"\r{percent}%, chunk {current_chunk} of {total_chunks} @ {approx_speed/1024:.2f} kb/s"
f"\r<{percent:3d}%, chunk {current_chunk:2d} of {total_chunks:2d} @ {approx_speed/1024:.2f} kb/s"
)
sys.stdout.flush()
print()
@@ -270,6 +270,7 @@ class FlipperStorage:
def read_file(self, filename: str):
"""Receive file from Flipper, and get filedata (bytes)"""
buffer_size = self.chunk_size
start_time = time.time()
self.send_and_wait_eol(
'storage read_chunks "' + filename + '" ' + str(buffer_size) + "\r"
)
@@ -290,10 +291,13 @@ class FlipperStorage:
filedata.extend(self.port.read(chunk_size))
read_size = read_size + chunk_size
percent = str(math.ceil(read_size / size * 100))
total_chunks = str(math.ceil(size / buffer_size))
current_chunk = str(math.ceil(read_size / buffer_size))
sys.stdout.write(f"\r{percent}%, chunk {current_chunk} of {total_chunks}")
percent = math.ceil(read_size / size * 100)
total_chunks = math.ceil(size / buffer_size)
current_chunk = math.ceil(read_size / buffer_size)
approx_speed = read_size / (time.time() - start_time + 0.0001)
sys.stdout.write(
f"\r>{percent:3d}%, chunk {current_chunk:2d} of {total_chunks:2d} @ {approx_speed/1024:.2f} kb/s"
)
sys.stdout.flush()
print()
self.read.until(self.CLI_PROMPT)