diff --git a/source/dev_LaminaAdapter.py b/source/dev_LaminaAdapter.py index 0e3a56b..dd6311b 100644 --- a/source/dev_LaminaAdapter.py +++ b/source/dev_LaminaAdapter.py @@ -101,12 +101,15 @@ modbus_map = { 0xAF: ["保留", 1], 0x100: ["版本", 4, 16], 0x110: ["型号", 4, 16], - 0x120: ["硬件", 4, 16], - 0x130: ["SN", 4, 16], - 0x140: ["MES", 4, 16], - 0x150: ["Datetime", 4, 16], - 0x160: ["载波芯片地址", 4, 16], - 0x170: ["厂商", 4, 16], + 0x120: ["载波芯片地址", 4, 16], + 0x130: ["厂商", 4, 8], + 0x138: ["保留", 4, 8], + 0x140: ["保留", 4, 16], + 0x150: ["保留", 4, 16], + 0x160: ["硬件", 4, 16], + 0x170: ["SN", 4, 16], + 0x180: ["MES", 4, 16], + 0x190: ["Datetime", 4, 16], } @@ -173,14 +176,14 @@ class LaminaAdapter: try: output_text = check_frame_dlt645(frame_recv, block=self.block) - cnt += 1 except Exception as e: print(e) + cnt += 1 continue print(output_text) break - if hasattr(self, 'frame_print'): + if hasattr(self, 'flag_print'): print(trans_list_to_str(frame)) print(trans_list_to_str(frame_recv)) diff --git a/source/func_frame.py b/source/func_frame.py index 04f0ce2..967d777 100644 --- a/source/func_frame.py +++ b/source/func_frame.py @@ -188,6 +188,7 @@ def display_data(modbus_map: dict, address: int, data: list): """ 字符串表示 """ data_len = current_map[2] item = display_str(data, data_len) + item = item.replace(b'\xff', b' 0xFF') item = item.decode() elif current_map[1] == 5: """ 载波地址表示 """ diff --git a/source/utl_upgrade.py b/source/utl_upgrade.py index 7a581b6..c8ddcc9 100644 --- a/source/utl_upgrade.py +++ b/source/utl_upgrade.py @@ -404,29 +404,33 @@ if __name__ == "__main__": back_data_e1 = bin_back.read_bytes()[184:] root = Path(r"D:\WorkingProject\LightStackAdapter\software\lamina_adapter\tools\uart_tool") - result = Path('result') + result = Path(r'D:\WorkingProject\LightStackAdapter\software\lamina_adapter\tools\uart_tool\生产版本3') # 正常启动镜像 - file_image = result / 'SLCP001_MEM.bin' - hex_boot = root / r"生产版本\bootloader.hex" - hex_main = root / r"生产版本\SLCP001_240525_1800_V1.12.hex" - hex_back = root / r"生产版本\SLCP001_240525_1800_B1.12.hex" + file_image = result / 'SLCP001_240528_1741_ROM.bin' + file_main_header = result / 'SLCP001_header_main.bin' + file_back_header = result / 'SLCP001_header_back.bin' + hex_boot = root / r"生产版本3\bootloader.hex" + hex_main = root / r"生产版本3\SLCP001_240528_1741_V1.01.hex" + hex_back = root / r"生产版本3\SLCP001_240528_1741_B1.01.hex" data_bins = test4(hex_boot, hex_main, hex_back) file_image.write_bytes(data_bins[0].copy()) + file_main_header.write_bytes(data_bins[1].copy()) + file_back_header.write_bytes(data_bins[4].copy()) # 异常镜像-主分区md5错误 - file_image = result / 'SLCP001_MEM_b1.bin' + file_image = result / 'SLCP001_240528_1741_ROM_b1.bin' data_image = data_bins[0].copy() data_image[0x0FC018: 0x0FC01A] = [0x00, 0x01] file_image.write_bytes(data_image) # 异常镜像-备份分区md5错误 - file_image = result / 'SLCP001_MEM_b2.bin' + file_image = result / 'SLCP001_240528_1741_ROM_b2.bin' data_image = data_bins[0].copy() data_image[0x0FE018: 0x0FE01A] = [0x00, 0x01] file_image.write_bytes(data_image) # 异常镜像-双分区md5错误 - file_image = result / 'SLCP001_MEM_b3.bin' + file_image = result / 'SLCP001_240528_1741_ROM_b3.bin' data_image = data_bins[0].copy() data_image[0x0FC018: 0x0FC01A] = [0x00, 0x01] data_image[0x0FE018: 0x0FE01A] = [0x00, 0x01]