rambo 3 月之前
父节点
当前提交
0f4e07eb3e
共有 3 个文件被更改,包括 18 次插入3 次删除
  1. 4 0
      python/config.ini
  2. 3 3
      python/mcu/capture/smart_shooter_class.py
  3. 11 0
      python/settings.py

+ 4 - 0
python/config.ini

@@ -42,3 +42,7 @@ right_foot_photograph = 99
 right_foot_action_1 = 99
 right_foot_action_2 = 99
 stop = 9
+
+[camera_config]
+low_iso = 100
+high_iso = 6400

+ 3 - 3
python/mcu/capture/smart_shooter_class.py

@@ -8,7 +8,7 @@ from io import BytesIO
 import base64
 import zmq, sys, time
 from utils.SingletonType import SingletonType
-
+from settings import LOW_ISO,HIGH_ISO
 import logging
 
 logger = logging.getLogger(__name__)
@@ -252,9 +252,9 @@ class SmartShooter(metaclass=SingletonType):
             return False, "请先连接相机"
         try:
             if enable_status == True:
-                await self.setCameraProperty(property="ISO", value=100)
+                await self.setCameraProperty(property="ISO", value=HIGH_ISO)
             if enable_status == False:
-                await self.setCameraProperty(property="ISO", value=6400)
+                await self.setCameraProperty(property="ISO", value=LOW_ISO)
             socket, context = self.__create_req()
             req = {}
             req["msg_type"] = "Request"

+ 11 - 0
python/settings.py

@@ -181,6 +181,17 @@ MOVE_DOWN = _mcu_config_dict["move_down"]
 STOP = _mcu_config_dict["stop"]
 
 
+camera_config_dict = config.items("camera_config")
+_camera_config_dict = {}
+for i, k in mcu_config_dict:
+    _camera_config_dict[i] = int(k)
+_camera_config_dict = get_config_by_items(camera_config_dict)
+
+LOW_ISO = _camera_config_dict["low_iso"]
+HIGH_ISO = _camera_config_dict["high_iso"]
+
+print("LOW_ISO", LOW_ISO)
+print("HIGH_ISO", HIGH_ISO)
 DOMAIN = (
     "https://dev2.valimart.net"
     if config.get("app", "env") != "dev"