Pārlūkot izejas kodu

```
feat(DeviceControl): 添加MCU正常回执数据打印功能

- 新增ID为255的命令处理函数print_mcu_noraml_data用于打印MCU正常回执数据
- 在消息处理映射表中注册255号命令,关联到新的打印函数
- 实现了完整的异常处理机制,确保程序稳定性
- 添加了十六进制格式的数据输出和日志记录功能
```

rambo 1 nedēļu atpakaļ
vecāks
revīzija
6e1de01d51
1 mainītis faili ar 11 papildinājumiem un 1 dzēšanām
  1. 11 1
      python/mcu/DeviceControl.py

+ 11 - 1
python/mcu/DeviceControl.py

@@ -127,6 +127,7 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
             90: self.get_from_mcu_connect_info,  # 获取链接电脑信号
             92: self.get_from_mcu_move_respond_data,  # 获取MCU响应
             100: self.print_mcu_error_data,  # 打印下位机的错误内容
+            255: self.print_mcu_noraml_data,  # 打印回执
         }
 
     async def sendCommand(self, command):
@@ -450,7 +451,16 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
             print("117 error {}".format(e))
             logger.info("117 error %s", e)
         return
-
+    def print_mcu_noraml_data(self, receive_data):
+        # 扫码数据
+        try:
+            receive_data_temp_text = " ".join([hex(x) for x in receive_data])
+            print("255  print_mcu_noraml_data:", receive_data_temp_text)
+            logger.info("255  print_mcu_noraml_data:%s", receive_data_temp_text)
+        except BaseException as e:
+            print("255 error {}".format(e))
+            logger.info("255 error %s", e)
+        return
     def get_from_mcu_move_respond_data(self, receive_data):
         self.last_from_mcu_move_respond_data = receive_data