This commit is contained in:
xyy
2026-05-13 14:16:57 +08:00
parent ccf046865d
commit b4e45a519b

View File

@@ -40,8 +40,8 @@ namespace 头罩视野.Views
//private DispatcherTimer testTimerForLight; //private DispatcherTimer testTimerForLight;
// 保存上一条数据(用于去重) // 保存上一条数据(用于去重)
private TestDataStore.TestRecord? _lastRecord; private TestDataStore.TestRecord? _lastRecord;
#region #region
private double currentAngle; private double currentAngle;
#endregion #endregion
@@ -159,7 +159,7 @@ namespace 头罩视野.Views
_isTesting = true; _isTesting = true;
ButtonTest.Content = "测试中..."; ButtonTest.Content = "测试中...";
// 面积也清空 // 面积也清空
@@ -201,10 +201,10 @@ namespace 头罩视野.Views
// 计算视野保存率(双目)根据左右目视野不同,算不同的值 // 计算视野保存率(双目)根据左右目视野不同,算不同的值
if (_leftFinalData != null && if (_leftFinalData != null &&
_leftFinalData.Count > 0 _leftFinalData.Count > 0
&& _rightFinalData != null && _rightFinalData != null
&& _rightFinalData.Count > 0&& _leftTotalArea!=0&& _rightTotalArea!=0) && _rightFinalData.Count > 0 && _leftTotalArea != 0 && _rightTotalArea != 0)
{ {
// ✅ 传值调用:把左右眼最终数据传给方法 // ✅ 传值调用:把左右眼最终数据传给方法
@@ -325,9 +325,8 @@ namespace 头罩视野.Views
// return; // return;
if (_modbusMaster == null) if (_modbusMaster == null)
return; return;
await _modbusMaster.ReadCoilsAsync(1, 1, 1);
var ret = await _modbusMaster.ReadCoilsAsync(1, 1, 1); var ret = await _modbusMaster.ReadCoilsAsync(1, 1, 2);
if (ret != null && ret.Length > 0) if (ret != null && ret.Length > 0)
{ //左眼开 { //左眼开
if (ret[0]) if (ret[0])
@@ -338,19 +337,18 @@ namespace 头罩视野.Views
btnLeft.Content = "左眼开"; btnLeft.Content = "左眼开";
btnRight.Content = "右眼关"; btnRight.Content = "右眼关";
} }
else else if (ret[1])
{ {
if ()
{ LedOn(led0);
LedOn(led0); LedOff(led1);
LedOff(led1); btnLeft.Content = "左眼关";
btnLeft.Content = "左眼关"; btnRight.Content = "右眼开";
btnRight.Content = "右眼开";
}
} }
} }
} }
//计算 //计算
private async Task calCurrentangle() private async Task calCurrentangle()
@@ -702,13 +700,13 @@ namespace 头罩视野.Views
btnLeft.Content = "左眼关"; btnLeft.Content = "左眼关";
LedOn(led0); LedOn(led0);
if (btnRight.Content.ToString() == "右眼关") if (btnRight.Content.ToString() == "右眼关")
{ {
btnRight.Content = "右眼开"; btnRight.Content = "右眼开";
LedOff(led1); LedOff(led1);
ma.BtnClickFunction(Function.ButtonType., 1); ma.BtnClickFunction(Function.ButtonType., 1);
} }
} }
else else
@@ -833,7 +831,7 @@ namespace 头罩视野.Views
//ymsyarea.Text = "7.00"; // 右目 //ymsyarea.Text = "7.00"; // 右目
//xfsyarea.Text = "8.00"; // 下方 //xfsyarea.Text = "8.00"; // 下方
//sybhl.Text = "9.00"; // 视野保存率 //sybhl.Text = "9.00"; // 视野保存率
} }
private void Page_Unloaded(object sender, RoutedEventArgs e) private void Page_Unloaded(object sender, RoutedEventArgs e)