优化代码

This commit is contained in:
2025-10-17 15:36:54 +08:00
parent 452aaaeaba
commit e3167a0144
2 changed files with 37 additions and 75 deletions

View File

@@ -49,10 +49,18 @@ class Processor:
# 根据指令类型,分发到不同的业务处理方法
if 'raw_485_command' in instruction:
self._process_exec_command(instruction['raw_485_command'])
cmd = instruction['raw_485_command']
if cmd:
self._process_exec_command(cmd)
else:
log("警告:'raw_485_command' 指令内容为空。")
elif 'batch_collect_command' in instruction:
self._process_collect_command(instruction['batch_collect_command'])
cmd = instruction['batch_collect_command']
if cmd:
self._process_collect_command(cmd)
else:
log("警告:'batch_collect_command' 指令内容为空。")
else:
log(f"警告:收到未知或不适用于此设备的指令类型: {instruction}")