浏览代码

激光延迟到获取到url开启

17600099689 10 月之前
父节点
当前提交
db8807b2d5
共有 2 个文件被更改,包括 5 次插入3 次删除
  1. 3 3
      Assets/BowArrow/Scripts/ArrowSerialPort.cs
  2. 2 0
      Assets/BowArrow/Scripts/SerialPortExample.cs

+ 3 - 3
Assets/BowArrow/Scripts/ArrowSerialPort.cs

@@ -72,9 +72,9 @@ public class ArrowSerialPort : MonoBehaviour
             //应用启动 间隔十秒请求一次设备信息
             //应用启动 间隔十秒请求一次设备信息
             CancelInvoke("RequestDeviceIno");
             CancelInvoke("RequestDeviceIno");
             InvokeRepeating("RequestDeviceIno", 0f, 10f);
             InvokeRepeating("RequestDeviceIno", 0f, 10f);
-            LOG($"{PortName} 串口打开成功!");
-            //激光默认打开
-            RequestLightState(true);
+            //LOG($"{PortName} 串口打开成功!");
+            ////激光默认打开
+            //RequestLightState(true);
         }
         }
         else if (msg.Equals("CLOSED"))//串口断开
         else if (msg.Equals("CLOSED"))//串口断开
         {
         {

+ 2 - 0
Assets/BowArrow/Scripts/SerialPortExample.cs

@@ -439,6 +439,8 @@ public class SerialPortExample : MonoBehaviour
         var homeView = FindObjectOfType<HomeView>();
         var homeView = FindObjectOfType<HomeView>();
         if (homeView != null)
         if (homeView != null)
             homeView.FlushUrlQR();
             homeView.FlushUrlQR();
+
+        SerialPortHelper.ins.GetPort()?.RequestLightState(true);
     }
     }
 
 
     void SendMessage(byte[] bytes,int index)
     void SendMessage(byte[] bytes,int index)