Selaa lähdekoodia

配置相关接口

rambo 7 kuukautta sitten
vanhempi
commit
42a65a86fc
3 muutettua tiedostoa jossa 14 lisäystä ja 117 poistoa
  1. 0 100
      python/action.json
  2. 14 0
      python/mcu/DeviceControl.py
  3. 0 17
      python/sockets/message_handler.py

+ 0 - 100
python/action.json

@@ -98,105 +98,5 @@
         "led_switch": false,
         "is_wait": false,
         "is_need_confirm": false
-    },
-    {
-        "tab_id": 2,
-        "execution_type": "程序2",
-        "action_name": "俯视",
-        "action_index": 10,
-        "picture_index": 99,
-        "camera_height": 200,
-        "camera_angle": 14.0,
-        "is_system": true,
-        "number_focus": 2,
-        "take_picture": true,
-        "turntable_position": 300.0,
-        "turntable_angle": -32.0,
-        "shoe_upturn": false,
-        "pre_delay": 0.0,
-        "after_delay": 0.0,
-        "led_switch": false,
-        "is_wait": false,
-        "is_need_confirm": false
-    },
-    {
-        "tab_id": 2,
-        "execution_type": "程序2",
-        "action_name": "侧视",
-        "action_index": 20,
-        "picture_index": 99,
-        "camera_height": 0,
-        "camera_angle": 3.0,
-        "is_system": true,
-        "number_focus": 0,
-        "take_picture": true,
-        "turntable_position": 300.0,
-        "turntable_angle": 0.0,
-        "shoe_upturn": false,
-        "pre_delay": 0.0,
-        "after_delay": 0.0,
-        "led_switch": false,
-        "is_wait": false,
-        "is_need_confirm": false
-    },
-    {
-        "tab_id": 2,
-        "execution_type": "程序2",
-        "action_name": "后跟",
-        "action_index": 30,
-        "picture_index": 99,
-        "is_system": true,
-        "camera_height": 0,
-        "camera_angle": 3.0,
-        "number_focus": 0,
-        "take_picture": true,
-        "turntable_position": 450.0,
-        "turntable_angle": 70.0,
-        "shoe_upturn": false,
-        "pre_delay": 0.0,
-        "after_delay": 0.0,
-        "led_switch": false,
-        "is_wait": false,
-        "is_need_confirm": false
-    },
-    {
-        "tab_id": 2,
-        "execution_type": "程序2",
-        "action_name": "鞋底",
-        "action_index": 40,
-        "picture_index": 99,
-        "is_system": true,
-        "camera_height": 0,
-        "camera_angle": 3.0,
-        "number_focus": 0,
-        "take_picture": true,
-        "turntable_position": 100.0,
-        "turntable_angle": 0.0,
-        "shoe_upturn": true,
-        "pre_delay": 0.0,
-        "after_delay": 0.0,
-        "led_switch": false,
-        "is_wait": false,
-        "is_need_confirm": false
-    },
-    {
-        "tab_id": 2,
-        "execution_type": "程序2",
-        "action_name": "内里",
-        "action_index": 50,
-        "picture_index": 99,
-        "is_system": true,
-        "camera_height": 0,
-        "camera_angle": 3.0,
-        "number_focus": 0,
-        "take_picture": true,
-        "turntable_position": 500.0,
-        "turntable_angle": 180.0,
-        "shoe_upturn": false,
-        "pre_delay": 0.0,
-        "after_delay": 0.0,
-        "led_switch": false,
-        "is_wait": false,
-        "is_need_confirm": false
     }
 ]

+ 14 - 0
python/mcu/DeviceControl.py

@@ -15,6 +15,7 @@ from databases import insert_photo_records
 from .McuDeviationSet import McuDeviationSet
 from .OtherSet import OtherSet
 from .DebugUart import DebugUart
+import copy
 
 # mcu命令
 class DeviceControl(BaseClass, metaclass=SingletonType):
@@ -1370,6 +1371,19 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
         image_counts = 0
         if config_list:
             action_names = []
+            if len(config_list) > 1:
+                if config_list[-1]["take_picture"] is True:
+                    new_init_config = copy.copy(config_list[0])
+                    new_init_config["action_name"] = "移动到初始位"
+                    new_init_config["number_focus"] = 0
+                    new_init_config["take_picture"] = False
+                    new_init_config["shoe_upturn"] = False
+                    new_init_config["pre_delay"] = 0.0
+                    new_init_config["after_delay"] = 0.0
+                    new_init_config["led_switch"] = True
+                    new_init_config["is_wait"] = False
+                    new_init_config["is_need_confirm"] = False
+                    config_list.append(new_init_config)
             for idx, item in enumerate(config_list):
                 is_take_picture = item["take_picture"]
                 action_id = item["id"]

+ 0 - 17
python/sockets/message_handler.py

@@ -68,23 +68,6 @@ async def handlerSend(
             device_ctrl.is_stop_action = True
         case "run_mcu":
             msg_type = "run_mcu"
-            # try:
-            #     # 判断拍照软件是否初始化
-            #     digicam = DigiCam()
-            #     camera_is_connect = digicam.checkCameraConnect()
-            #     if camera_is_connect is not True:
-            #         data = manager.jsonMessage(
-            #             code=1, msg="相机未连接,请检查", msg_type=msg_type
-            #         )
-            #         await manager.send_personal_message(data, websocket)
-            #         return
-            #     digicam.getCaptureFolderPath()
-            # except:
-            #     data = manager.jsonMessage(
-            #         code=1, msg="digicam未初始化,请检查", msg_type=msg_type
-            #     )
-            #     await manager.send_personal_message(data, websocket)
-            #     return
             action_info = data.get("action", "执行左脚程序")
             goods_art_no = data.get("goods_art_no", None)
             if goods_art_no == None or goods_art_no =="":