mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 20:49:49 +04:00
[FL-3300] API version in UI (#2649)
* desktop, about: replaced commit# with API version * scripts: storage: added approx speed for file uploads * scripts: selfupdate: use folder name by default * vscode: fixed broken get_blackmagic shell integration on *nix Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import os
|
||||
import sys
|
||||
import serial
|
||||
import time
|
||||
import hashlib
|
||||
import math
|
||||
import logging
|
||||
import posixpath
|
||||
import enum
|
||||
import hashlib
|
||||
import logging
|
||||
import math
|
||||
import os
|
||||
import posixpath
|
||||
import sys
|
||||
import time
|
||||
|
||||
import serial
|
||||
|
||||
|
||||
def timing(func):
|
||||
@@ -236,6 +237,7 @@ class FlipperStorage:
|
||||
filesize = os.fstat(file.fileno()).st_size
|
||||
|
||||
buffer_size = self.chunk_size
|
||||
start_time = time.time()
|
||||
while True:
|
||||
filedata = file.read(buffer_size)
|
||||
size = len(filedata)
|
||||
@@ -254,11 +256,13 @@ class FlipperStorage:
|
||||
self.port.write(filedata)
|
||||
self.read.until(self.CLI_PROMPT)
|
||||
|
||||
percent = str(math.ceil(file.tell() / filesize * 100))
|
||||
ftell = file.tell()
|
||||
percent = str(math.ceil(ftell / filesize * 100))
|
||||
total_chunks = str(math.ceil(filesize / buffer_size))
|
||||
current_chunk = str(math.ceil(file.tell() / buffer_size))
|
||||
current_chunk = str(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}"
|
||||
f"\r{percent}%, chunk {current_chunk} of {total_chunks} @ {approx_speed/1024:.2f} kb/s"
|
||||
)
|
||||
sys.stdout.flush()
|
||||
print()
|
||||
|
||||
Reference in New Issue
Block a user