调整脚本结构, 清理冗余代码;
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import time
|
||||
from pathlib import Path
|
||||
from serial import Serial
|
||||
from utl import trans_list_to_str
|
||||
from tools.ByteConv import trans_list_to_str
|
||||
from func_frame import make_frame_dlt645, check_frame_dlt645
|
||||
|
||||
modbus_map = {
|
||||
@@ -92,7 +92,7 @@ modbus_map = {
|
||||
0xA6: ["抖动频率下限", 2],
|
||||
0xA7: ["电池电压判断限值", 2],
|
||||
0xA8: ["MPPT追踪模式", 1],
|
||||
0xA9: ["ADC参考电压", 1],
|
||||
0xA9: ["ADC参考电压", 2],
|
||||
0xAA: ["保留", 1],
|
||||
0xAB: ["保留", 1],
|
||||
0xAC: ["保留", 1],
|
||||
@@ -346,11 +346,11 @@ if __name__=='__main__':
|
||||
"Log": {'com_name': None,
|
||||
# 'addr_645': [0x01, 0x00, 0x00, 0x00, 0x00, 0x40],
|
||||
},
|
||||
"Debug": {'com_name': 'COM8', 'baudrate': 115200, 'parity': 'N', 'bytesize': 8, 'stopbits': 1,
|
||||
"Debug": {'com_name': 'COM11', 'baudrate': 115200, 'parity': 'N', 'bytesize': 8, 'stopbits': 1,
|
||||
# 'addr_645': [0x01, 0x02, 0x03, 0x04, 0x05, 0x06],
|
||||
'frame_print': True,
|
||||
'time_out': 0.1, 'retry': 1, 'retry_sub': 10},
|
||||
"HPLC": {'com_name': 'COM4', 'baudrate': 9600, 'parity': 'E', 'bytesize': 8, 'stopbits': 1,
|
||||
"HPLC": {'com_name': 'COM10', 'baudrate': 9600, 'parity': 'E', 'bytesize': 8, 'stopbits': 1,
|
||||
# 'addr_645': [0x01, 0x02, 0x03, 0x04, 0x05, 0x06],
|
||||
'frame_print': True,
|
||||
'time_out': 0.5, 'retry': 3, 'retry_sub': 10},
|
||||
@@ -361,6 +361,22 @@ if __name__=='__main__':
|
||||
|
||||
dev_lamina.frame_read(0x0100, 0x20)
|
||||
|
||||
if 0:
|
||||
dev_lamina.frame_read(0xA9, 1) # 读ADC参考电压
|
||||
dev_lamina.frame_write_one(0xA9, 2000) # 写ADC参考电压:2.0V
|
||||
dev_lamina.frame_write_one(0xA9, 3300) # 写ADC参考电压:3.3V
|
||||
dev_lamina.frame_read(0x13, 1) # 读输入电压
|
||||
dev_lamina.frame_read(0x16, 1) # 读输出电压
|
||||
dev_lamina.frame_read(0x97, 4) # 读校准参数: Vin_a, Vin_b, Vout_a, Vout_b
|
||||
dev_lamina.frame_write_one(0x97, 1000) # 写校准参数Vin_a: 1.000
|
||||
dev_lamina.frame_write_one(0x97, 1500) # 写校准参数Vin_a: 1.500
|
||||
dev_lamina.frame_write_one(0x98, 100) # 写校准参数Vin_b: 1.00
|
||||
dev_lamina.frame_write_one(0x98, 150) # 写校准参数Vin_b: 1.50
|
||||
dev_lamina.frame_write_one(0x99, 1000) # 写校准参数Vout_a: 1.000
|
||||
dev_lamina.frame_write_one(0x99, 1500) # 写校准参数Vout_a: 1.500
|
||||
dev_lamina.frame_write_one(0x9A, 1000) # 写校准参数Vout_a: 1.00
|
||||
dev_lamina.frame_write_one(0x9A, 1500) # 写校准参数Vout_a: 1.50
|
||||
|
||||
if 0:
|
||||
dev_lamina.frame_write_str(0x82, [0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA])
|
||||
dev_lamina.frame_write_str(0x82, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
|
||||
@@ -434,7 +450,7 @@ if __name__=='__main__':
|
||||
dev_lamina.frame_read(0x0170, 0x30)
|
||||
|
||||
if not hasattr(__builtins__,"__IPYTHON__"):
|
||||
path_bin = Path(r"D:\WorkingProject\LightStackAdapter\software\lamina_adapter\tools\upgrade\SLCP001_240604_1200_V1.01a.bin")
|
||||
path_bin = Path(r"D:\WorkSpace\UserTool\SelfTool\FrameParser\test\p460\result\lamina_adapter_t1.dat")
|
||||
# path_bin = Path(r"D:\WorkingProject\LightStackAdapter\software\lamina_adapter\tools\upgrade\SLCP001_240520_0000_T1.11.bin")
|
||||
# 生产镜像版本
|
||||
# path_bin = Path(r"D:\WorkingProject\LightStackAdapter\software\lamina_adapter\tools\upgrade\SLCP001_240525_1800_V1.12.bin")
|
||||
|
||||
Reference in New Issue
Block a user