Quellcode durchsuchen

ISO设置问题以及设备类型区分

rambo vor 3 Monaten
Ursprung
Commit
0c72b536ee
3 geänderte Dateien mit 20 neuen und 998 gelöschten Zeilen
  1. 0 989
      python/api.py
  2. 18 8
      python/mcu/capture/smart_shooter_class.py
  3. 2 1
      python/settings.py

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 989
python/api.py


+ 18 - 8
python/mcu/capture/smart_shooter_class.py

@@ -278,7 +278,16 @@ class SmartShooter(metaclass=SingletonType):
             context.term()
             msg_send = "相机未连接或软件未打开"
             return False, msg_send
-
+    async def getConfigIso(self):
+            """获取ISO配置信息"""
+            camera_configs = settings.getSysConfigs(
+                "camera_configs",
+                "iso_config",
+                {"low": 100, "high": 6400, "mode": "un_auto"},
+            )
+            low_iso = camera_configs.get("low", 100)
+            high_iso = camera_configs.get("high", 6400)
+            return low_iso, high_iso
     async def EnableCameraPreview(self, enable_status=True, msg_type=""):
         self.msg_type = msg_type
         await self.SetCameraFPS(5)
@@ -289,13 +298,7 @@ class SmartShooter(metaclass=SingletonType):
         if not camera_states:
             return False, "请先连接相机"
         try:
-            camera_configs = settings.getSysConfigs(
-                "camera_configs",
-                "iso_config",
-                {"low": 100, "high": 6400, "mode": "un_auto"},
-            )
-            low_iso = camera_configs.get("low", 100)
-            high_iso = camera_configs.get("high", 6400)
+            low_iso,high_iso = self.getConfigIso()
             print("LOW_ISO", low_iso)
             print("HIGH_ISO", high_iso)
             # 等于auto就不设置
@@ -409,6 +412,13 @@ class SmartShooter(metaclass=SingletonType):
         if not camera_states:
             return False, "请先连接相机"
         try:
+            low_iso,high_iso = self.getConfigIso()
+            print("LOW_ISO", low_iso)
+            print("HIGH_ISO", high_iso)
+            if str(low_iso).lower() != "auto":
+                    await self.setCameraProperty(property="ISO", value=str(low_iso))
+            else:
+                    print("low_iso 等于auto就不设置")
             socket, context = self.__create_req()
             req = {}
             req["msg_type"] = "Request"

+ 2 - 1
python/settings.py

@@ -19,7 +19,8 @@ from databases import (
     batch_insert_device_configs,
     batch_insert_device_configsNew,
 )
-
+# 追加配置参数 machine_type 拍照机设备类型;0鞋;1服装
+MACHINE_TYPE = 0
 # 初始化数据表
 create_all_database()
 session = SqlQuery()

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.