From 67f240b109cd1d2eb6505b51e6b46ce9bbd4c08e Mon Sep 17 00:00:00 2001 From: ranchuan Date: Mon, 16 Oct 2023 18:54:06 +0800 Subject: [PATCH] =?UTF-8?q?updata.py=20=20=E6=B7=BB=E5=8A=A0=E5=AF=B9.pkt?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ReadMe.txt | 3 ++- coder/code_with_checker.py | 2 ++ updata/prottcp.py | 2 +- updata/updata.py | 12 +++++++----- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ReadMe.txt b/ReadMe.txt index eeb7dd8..2632512 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -71,5 +71,6 @@ 添加jwt模块程序升级命令0xec 添加赋码仪批检仪联动脚本 发送文件时打印文件的crc32 - +2023.10.16 + updata.py 添加对.pkt文件的支持 diff --git a/coder/code_with_checker.py b/coder/code_with_checker.py index 4fc684e..5ccf65c 100644 --- a/coder/code_with_checker.py +++ b/coder/code_with_checker.py @@ -202,6 +202,8 @@ class port: self.recv_code(5) # 接收检测结果 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])) # # 接收指令应答 diff --git a/updata/prottcp.py b/updata/prottcp.py index 1d0a1d1..f520b33 100644 --- a/updata/prottcp.py +++ b/updata/prottcp.py @@ -229,7 +229,7 @@ class handle: with open(name,"rb") as f: self.data=f.read() 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.packet_all=(len(self.data)+199)//200 self.sent_bytes=0 diff --git a/updata/updata.py b/updata/updata.py index c271ac6..9dc25ca 100644 --- a/updata/updata.py +++ b/updata/updata.py @@ -368,14 +368,16 @@ class updata_dlg(QObject): return False # 找到已选择的文件 - def get_selected_file_by_type(self,type:str): + def get_selected_file_by_type(self,types:list): file_list=[] items=self.file_list.selectedItems() 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()) if(len(file_list)!=1): - self.show_msg("请选择一个并且只选择一个 "+type+" 文件") + self.show_msg("请选择一个并且只选择一个 "+str(types)+" 文件") return "" return file_list[0] @@ -534,7 +536,7 @@ class updata_dlg(QObject): if(len(slave_list)==0): return 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): return print("file:",file) @@ -646,7 +648,7 @@ class updata_dlg(QObject): # 扫描文件 def scan_file(self): 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):