From 60c5285bcf1b8cd269feaebd4ab20252e5be7fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=20=E6=B3=BD=E9=9A=86?= Date: Thu, 8 Aug 2024 17:06:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8D=87=E7=BA=A7=E5=8C=85?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=BB=93=E6=9E=9C=E4=B8=8E=E6=89=93=E5=8C=85?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E4=B8=8D=E4=B8=80=E8=87=B4=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98;=20=20-=20=E8=B0=83=E6=8D=A2=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E4=B8=8E=E5=8E=8B=E7=BC=A9=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E5=AD=97=E8=8A=82=E4=BD=8D=E7=BD=AE;=20=20-=20=E8=B0=83?= =?UTF-8?q?=E6=8D=A2=E6=96=87=E4=BB=B6=E5=A4=B4=E6=A0=A1=E9=AA=8C=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=E7=AB=AF;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/utl_upgrade.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/utl_upgrade.py b/source/utl_upgrade.py index d20bb90..3743405 100644 --- a/source/utl_upgrade.py +++ b/source/utl_upgrade.py @@ -158,15 +158,15 @@ def build_header_new(config: dict): m_file_header[8:10] = config['prod_type'] m_file_header[10:22] = config['prog_id'] + [0] * (12 - len(config['prog_id'])) if config['method_compress'] == True: - m_file_header[22] = 0x01 + m_file_header[23] = 0x01 else: - m_file_header[22] = 0x00 + m_file_header[23] = 0x00 if 'crc32' in config.keys(): - m_file_header[23] = 0x00 + m_file_header[22] = 0x00 m_file_header[24: 40] = config['crc32'] + [0x00] * 12 elif 'md5' in config.keys(): - m_file_header[23] = 0x01 + m_file_header[22] = 0x01 m_file_header[24: 40] = config['md5'] else: raise Exception("Error, Unknown method verify.") @@ -212,7 +212,7 @@ def build_header_new(config: dict): calculator = Calculator(Crc16.MODBUS) code_crc16 = calculator.checksum(m_file_header[:-2]) - m_file_header[182: 184] = [code_crc16 % 0x100, code_crc16 // 0x100] + m_file_header[182: 184] = [code_crc16 // 0x100, code_crc16 % 0x100] return m_file_header