修复raise语句用法;
添加float数据解析; 更新升级传输方案;
This commit is contained in:
@@ -30,11 +30,11 @@ def file_IntelHex_to_Bin(file_data, base_address, len_max=0xC000, conv_end=False
|
||||
max_address = 0
|
||||
for line in lines:
|
||||
if max_address >= len_max:
|
||||
raise("Bin file Oversize.")
|
||||
raise Exception("Bin file Oversize.")
|
||||
if line[0] == ':':
|
||||
checksum = sum([int(x, 16) * (15 * (~i & 0x01) + 1) for i, x in enumerate(line[1:])])
|
||||
if (checksum & 0x00FF) != 0:
|
||||
raise('Hex file checksum error!')
|
||||
raise Exception('Hex file checksum error!')
|
||||
|
||||
if line[7:9] == '00':
|
||||
len = int(line[1:3], 16)
|
||||
@@ -170,7 +170,7 @@ def make_datafile2(file_path: str, config: dict, header_len=512):
|
||||
|
||||
data_header = build_header(config, header_len)
|
||||
if data_header is None:
|
||||
raise("Header tag oversize. ")
|
||||
raise Exception("Header tag oversize. ")
|
||||
data_encrypt = file_encryption(data_bin)
|
||||
return data_header, data_bin, data_encrypt
|
||||
|
||||
|
||||
Reference in New Issue
Block a user