修复备份程序打包功能缺陷;

This commit is contained in:
何 泽隆
2025-01-22 19:14:01 +08:00
parent 7cf26cf898
commit 67b238b56a

View File

@@ -256,7 +256,7 @@ class LaminaAdapter(DeviceSerial):
self.block['data']['step'] = step self.block['data']['step'] = step
return self._transfer_data() return self._transfer_data()
def frame_update(self, path_file: Path, makefile: bool = False, savefile: bool = False) -> bool: def frame_update(self, path_file: Path, makefile: bool = False, savefile: bool = False, **kwargs) -> bool:
""" 程序升级 """ 程序升级
注意: 在使用单板升级测试时, 需要关闭低电压检测功能, 否则无法启动升级流程; 注意: 在使用单板升级测试时, 需要关闭低电压检测功能, 否则无法启动升级流程;
@@ -268,7 +268,7 @@ class LaminaAdapter(DeviceSerial):
if not path_file.exists(): if not path_file.exists():
raise Exception("工程编译目标文件不存在.") raise Exception("工程编译目标文件不存在.")
if makefile and self.make_package is not None: if makefile and self.make_package is not None:
self.block['data']['file'] = self.make_package(path_file) self.block['data']['file'] = self.make_package(path_file, **kwargs)
if savefile: if savefile:
path_file.parent.joinpath(path_file.stem + '.dat').write_bytes(self.block['data']['file']) path_file.parent.joinpath(path_file.stem + '.dat').write_bytes(self.block['data']['file'])
else: else:
@@ -311,13 +311,15 @@ class LaminaAdapter(DeviceSerial):
return False return False
self.flag_print, self.retry, self.time_out = param_saved self.flag_print, self.retry, self.time_out = param_saved
time.sleep(6)
self.frame_read(0x100, 0x20)
return True return True
def GeneratePackage(type_dev: str, path_hex: Path, **kwargs) -> bytearray: def GeneratePackage(type_dev: str, path_hex: Path, **kwargs) -> bytearray:
""" 生成升级包 """ """ 生成升级包 """
if 'upgrade_backup' in kwargs.keys(): upgrade_backup = kwargs['upgrade_backup'] if 'upgrade_backup' in kwargs.keys() else None
upgrade_backup = kwargs['upgrade_backup']
config = { config = {
'prod_type': [0x45, 0x00], # 产品类型 'prod_type': [0x45, 0x00], # 产品类型
'method_compress': False, # 文件压缩 'method_compress': False, # 文件压缩