This commit is contained in:
2026-05-06 09:46:25 +08:00
parent c707b4994e
commit d581fddb76

View File

@@ -207,7 +207,7 @@ namespace 头罩视野.Views
}
//测试btn 测试按钮:读取数据,存入共享列表
private void Button_Click_Test(object sender, RoutedEventArgs e)
private async void Button_Click_Test(object sender, RoutedEventArgs e)
{
ma.BtnClickFunction(Function.ButtonType., 100);
@@ -250,8 +250,11 @@ namespace 头罩视野.Views
// 2. 从0转到180每 stepAngle 执行一次
for (double current = stepAngle; current <= 180; current += stepAngle)
{
await ReadLightBarData();
// 读完再转数组
int[] lightData = DataList.Cast<int>().ToArray();
_ = ReadLightBarData();
//开始计算视野面积
double singleArea = GetArea.CalculateEllipseArea(lightData, _lightPositions);
@@ -330,6 +333,7 @@ namespace 头罩视野.Views
try
{
DataList.Clear();
// 读取灯条寄存器地址350长度15
ushort[] registers = await _modbusMaster.ReadHoldingRegistersAsync(1, 350, 15);