rambo 8 月之前
父节点
当前提交
fd2a5c4cad
共有 2 个文件被更改,包括 16 次插入10 次删除
  1. 12 10
      python/mcu/DeviceControl.py
  2. 4 0
      python/mcu/ProgramItem.py

+ 12 - 10
python/mcu/DeviceControl.py

@@ -935,6 +935,7 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
 
         cmd = 1
         device_id = self.device_name_dict[device_name]
+        print("正在执行",device_name)
         match device_name:
             case "camera_high_motor":
                 # value 单位毫米
@@ -1261,17 +1262,18 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
                 print("action异常终止")
                 return
             self.msg_type = "photo_take"
-            if not program_item.run(1):
-                self.sendSocketMessage(
-                        code=1,
-                        msg="{} 执行失败~".format(program_item.action_name),
-                        device_status=0,
-                    )
-                self.to_deal_device(device_name="buzzer", times=3)
-                return
-            else:
+            # if not program_item.run_only_mcu(1):
+            #     self.sendSocketMessage(
+            #             code=1,
+            #             msg="{} 执行失败~".format(program_item.action_name),
+            #             device_status=0,
+            #         )
+            #     self.to_deal_device(device_name="buzzer", times=3)
+            #     return
+            # else:
+            program_item.run_only_mcu(1)
                 # self.show_info("{}执行完成~".format(action.action_name))
-                self.sendSocketMessage(
+            self.sendSocketMessage(
                         code=0,
                         msg="{} 执行完成~".format(program_item.action_name),
                         data={"goods_art_no": goods_art_no},

+ 4 - 0
python/mcu/ProgramItem.py

@@ -16,6 +16,7 @@ class ProgramItem(BaseClass):
         # 1 表示等待中,2表示没有等待
         self.wait_state = 2
         self.msg_type = "mcu"
+        print("action_data====>", action_data)
         self.data = action_data
         self.capture_one = DigiCam()
         captrure_folder_path = self.capture_one.getCaptureFolderPath()
@@ -73,7 +74,9 @@ class ProgramItem(BaseClass):
     def get_value(self, data, key, default=None):
         if key not in data:
             data[key] = default
+            print("取值模式==>获取到key:{}的值为:{}".format(key, data[key]))
             return default
+        print("默认值模式==>获取到key:{}的值为:{}".format(key, data[key]))
         return data[key]
 
     def reset(self):
@@ -203,6 +206,7 @@ class ProgramItem(BaseClass):
                     device_name="turntable_steering", value=self.turntable_angle
                 )
                 time.sleep(0.1)
+            self.mcu.send_all_cmd()
 
     def do_run(self, *args):
         # if not self.goods_art_no:  # and self.action_name != "初始化位置"