updata.py 添加对.pkt文件的支持
This commit is contained in:
@@ -71,5 +71,6 @@
|
|||||||
添加jwt模块程序升级命令0xec
|
添加jwt模块程序升级命令0xec
|
||||||
添加赋码仪批检仪联动脚本
|
添加赋码仪批检仪联动脚本
|
||||||
发送文件时打印文件的crc32
|
发送文件时打印文件的crc32
|
||||||
|
2023.10.16
|
||||||
|
updata.py 添加对.pkt文件的支持
|
||||||
|
|
||||||
|
@@ -202,6 +202,8 @@ class port:
|
|||||||
self.recv_code(5)
|
self.recv_code(5)
|
||||||
# 接收检测结果
|
# 接收检测结果
|
||||||
self.recv_code(24)
|
self.recv_code(24)
|
||||||
|
# 回复检测结果
|
||||||
|
self.send_code(bytearray([0xF0, 0x00, 0x02, 0xE0, 0x41]))
|
||||||
# 开始注码
|
# 开始注码
|
||||||
# self.send_code(bytearray([0xF0, 0x00, 0x02, 0xE0, 0x41, 0xB1, 0x00, 0x02, 0x00, 0xFB]))
|
# self.send_code(bytearray([0xF0, 0x00, 0x02, 0xE0, 0x41, 0xB1, 0x00, 0x02, 0x00, 0xFB]))
|
||||||
# # 接收指令应答
|
# # 接收指令应答
|
||||||
|
@@ -229,7 +229,7 @@ class handle:
|
|||||||
with open(name,"rb") as f:
|
with open(name,"rb") as f:
|
||||||
self.data=f.read()
|
self.data=f.read()
|
||||||
self.name=f.name.split('/')[-1]
|
self.name=f.name.split('/')[-1]
|
||||||
print("file:{d1},crc32={d2}".format(d1=self.name,d2=hex(crc32(self.data))))
|
# print("file:{d1},crc32={d2}".format(d1=self.name,d2=hex(crc32(self.data))))
|
||||||
self.stat=0
|
self.stat=0
|
||||||
self.packet_all=(len(self.data)+199)//200
|
self.packet_all=(len(self.data)+199)//200
|
||||||
self.sent_bytes=0
|
self.sent_bytes=0
|
||||||
|
@@ -368,14 +368,16 @@ class updata_dlg(QObject):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# 找到已选择的文件
|
# 找到已选择的文件
|
||||||
def get_selected_file_by_type(self,type:str):
|
def get_selected_file_by_type(self,types:list):
|
||||||
file_list=[]
|
file_list=[]
|
||||||
items=self.file_list.selectedItems()
|
items=self.file_list.selectedItems()
|
||||||
for i in items:
|
for i in items:
|
||||||
if(i.text()[-len(type):]==type):
|
sp=i.text().split(".")[-1]
|
||||||
|
sp='.'+sp
|
||||||
|
if(sp in types):
|
||||||
file_list.append(i.text())
|
file_list.append(i.text())
|
||||||
if(len(file_list)!=1):
|
if(len(file_list)!=1):
|
||||||
self.show_msg("请选择一个并且只选择一个 "+type+" 文件")
|
self.show_msg("请选择一个并且只选择一个 "+str(types)+" 文件")
|
||||||
return ""
|
return ""
|
||||||
return file_list[0]
|
return file_list[0]
|
||||||
|
|
||||||
@@ -534,7 +536,7 @@ class updata_dlg(QObject):
|
|||||||
if(len(slave_list)==0):
|
if(len(slave_list)==0):
|
||||||
return
|
return
|
||||||
print("slaves:",slave_list)
|
print("slaves:",slave_list)
|
||||||
file=self.get_selected_file_by_type(".bin")
|
file=self.get_selected_file_by_type([".bin",".pkt"])
|
||||||
if(len(file)==0):
|
if(len(file)==0):
|
||||||
return
|
return
|
||||||
print("file:",file)
|
print("file:",file)
|
||||||
@@ -646,7 +648,7 @@ class updata_dlg(QObject):
|
|||||||
# 扫描文件
|
# 扫描文件
|
||||||
def scan_file(self):
|
def scan_file(self):
|
||||||
self.file_list.clear()
|
self.file_list.clear()
|
||||||
self.file_list.addItems(self.find_type([".sh",".elf",".bin",".lua",".json",".dtb",".axf",".py",".service"]))
|
self.file_list.addItems(self.find_type([".sh",".elf",".bin",".pkt",".lua",".json",".dtb",".axf",".py",".service"]))
|
||||||
|
|
||||||
# 扫描从机
|
# 扫描从机
|
||||||
def scan_slave(self):
|
def scan_slave(self):
|
||||||
|
Reference in New Issue
Block a user