Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File size changed #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions code/Dialog_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def choose_img(self):
Select the firmware
Select the firmware, copy the user's firmware to the current working directory,
and calculate the SHA256 value of the file, and verify whether the file is Dout,
and the firmware size is less than 508k,
and the firmware size is less than 608k,
and whether it is a ".bin "file
:return:
"""
Expand Down Expand Up @@ -554,19 +554,19 @@ def choose_img(self):
QMessageBox.information(
self,
"ERROR",
"Firmware file cannot be greater than 508k; The firmware must be Dout",
"Firmware file cannot be greater than 608k; The firmware must be Dout",
QMessageBox.Yes,
QMessageBox.Yes)

def get_file_to_work(self, bin_file):
"""
calculate the SHA256 value of the file, and verify whether the file is Dout,
and the firmware size is less than 508k,
and the firmware size is less than 608k,
"""
try:
with open(bin_file, 'rb') as file_obj:
b = bytearray(file_obj.read())
if (b[2] == 3)and(len(b) < 508000):
if (b[2] == 3)and(len(b) < 608000):
file_obj.seek(0, 0)
img = file_obj.read()
else:
Expand Down