[FL-3003] Fix logical error in storage script (#2105)

* Fix logical error in storage script
* Fix formatting
This commit is contained in:
Georgii Surkov 2022-12-08 12:31:22 +03:00 committed by GitHub
parent 5c3a5cd8f7
commit df808be8d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -238,9 +238,9 @@ class FlipperStorage:
while read_size < size: while read_size < size:
self.read.until("Ready?" + self.CLI_EOL) self.read.until("Ready?" + self.CLI_EOL)
self.send("y") self.send("y")
read_size = min(size - read_size, buffer_size) chunk_size = min(size - read_size, buffer_size)
filedata.extend(self.port.read(read_size)) filedata.extend(self.port.read(chunk_size))
read_size = read_size + read_size read_size = read_size + chunk_size
percent = str(math.ceil(read_size / size * 100)) percent = str(math.ceil(read_size / size * 100))
total_chunks = str(math.ceil(size / buffer_size)) total_chunks = str(math.ceil(size / buffer_size))