|
|
@@ -225,7 +225,7 @@ public class ShootCheck : MonoBehaviour
|
|
|
return (int)shortNum;
|
|
|
}
|
|
|
|
|
|
- public float arrowWeight = 60; //实体模具箭重,单位克
|
|
|
+ public float arrowWeight = 75; //实体模具箭重,单位克
|
|
|
|
|
|
bool check(float ax, float ay, float az, string t)
|
|
|
{
|
|
|
@@ -325,12 +325,19 @@ public class ShootCheck : MonoBehaviour
|
|
|
}
|
|
|
|
|
|
public string ShootByInfrared(byte[] bytes) {
|
|
|
- float time1 = ((bytes[5] << 8) + bytes[6]) * 0.1f;
|
|
|
- float time2 = ((bytes[7] << 8) + bytes[8]) * 0.1f;
|
|
|
+ int id = bytes[1];
|
|
|
+ float time1 = bytes[2] * 0.1f;
|
|
|
+ float time2 = bytes[3] * 0.1f;
|
|
|
+ int sumCheck = bytes[0] + bytes[1] + bytes[2] + bytes[3];
|
|
|
+ sumCheck &= 0xff;
|
|
|
+ bool sumCheckRes = sumCheck == bytes[4];
|
|
|
float speed = 0.05f / (time1 / 1000 + time2 / 1000);
|
|
|
shootSpeed = Mathf.Sqrt(speed * speed * arrowWeight / LoginMgr.myUserInfo.actualArrowWeight);
|
|
|
- string logTxt = $"时长1:{time1}毫秒,时长2:{time2}毫秒,弓轨速度:{speed}m/s,箭的速度:{shootSpeed}m/s";
|
|
|
- Debug.Log(logTxt);
|
|
|
+ string logTxt = $"序号{id},时长1:{time1}毫秒,时长2:{time2}毫秒,和校验结果:{sumCheckRes},弓轨速度:{speed}m/s,箭的速度:{shootSpeed}m/s";
|
|
|
+ Debug.LogWarning(logTxt);
|
|
|
+ try {
|
|
|
+ if (sumCheckRes) BluetoothAim.ins.WriteData("I"); //如果数据正确,则回复硬件
|
|
|
+ } catch (Exception) {}
|
|
|
try {
|
|
|
ShootCheck.ins.webSocket.Send(logTxt);
|
|
|
} catch (Exception) {}
|