Commit 86c88ac0 authored by rgaudin's avatar rgaudin
Browse files

Fixed #194: refresh logger every 100MiB on SD-card writting (was 4KiB)

parent 96482f82
2.0-rc4
* Use decimal (GB) sizes for SD card selection
* Fixed logger refresh while writing to SD-card
2.0-rc3
* Static content selection window display all contents, not only those selected [regression]
......
......@@ -138,14 +138,21 @@ class Emulator:
os.lseek(image, 0, os.SEEK_SET)
current_percentage = 0.0
refresh_every = 100 * ONE_MiB
while True:
current_size = os.lseek(image, 0, os.SEEK_CUR)
new_percentage = (100 * current_size) / total_size
if new_percentage != current_percentage:
current_percentage = new_percentage
self._logger.progress(current_percentage / 100)
self._logger.std(str(current_percentage) + "%\r")
if current_size % refresh_every == 0:
self._logger.progress(current_percentage / 100)
self._logger.std(
"Copied {copied} of {total} ({pc:.2}%)"
.format(copied=human_readable_size(current_size),
total=human_readable_size(total_size),
pc=current_percentage))
buf = os.read(image, 4096)
if buf == b"":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment