调试版本不弹出上传提示框

This commit is contained in:
ranchuan
2024-01-09 18:06:34 +08:00
parent bcbd02a72c
commit e716aa4149
5 changed files with 15 additions and 17 deletions

View File

@@ -134,14 +134,13 @@ def creat_head(data:bytearray,date:str):
return head
def main():
def main(cmd_str:str):
date=time.get_date()
src=APP_FILE_SRC+".bin"
dst=APP_FILE_DST+"_"+date+".pkt"
if not os.path.exists(src):
print(src+' File Error!!!')
else:
if os.path.exists(dst):
os.remove(dst)
file = open(src,"rb")
@@ -153,12 +152,10 @@ def main():
with open(dst,"wb") as f:
f.write(data)
print(dst+' create app file success.')
readback=os.popen("upload "+SQL_APP_PATH+" "+dst).readlines()
for i in readback:
print(i)
# sql=mysql.sql()
# if(sql.init(SQL_APP_PATH)==True):
# sql.insert(dst)
if(cmd_str=="app"):
readback=os.popen("upload "+SQL_APP_PATH+" "+dst).readlines()
for i in readback:
print(i)
boot=BOOT_FILE_SRC+".bin"
boot_dst=BOOT_FILE_DST+"_"+date+".bin"
if os.path.exists(boot):
@@ -173,11 +170,11 @@ def main():
with open(boot_dst,"wb") as f:
f.write(d)
print(boot_dst+" create boot file success.")
#sql=mysql.sql()
#if(sql.init(SQL_BOOT_PATH)==True):
# sql.insert(boot_dst)
else:
print("please build bootloader to create boot file")
if __name__=="__main__":
main()
cmd_str="app"
if len(sys.argv)>=2:
cmd_str=sys.argv[1]
main(cmd_str)