更新CAN和数据中心的关联实时数据

This commit is contained in:
2025-01-07 14:02:30 +08:00
parent 1336d082e2
commit 93f9558cac
2 changed files with 63 additions and 28 deletions

View File

@@ -3,6 +3,7 @@ using CapMachine.Wpf.CanDrive;
using ImTools;
using Prism.Ioc;
using Prism.Mvvm;
using SharpDX;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -17,7 +18,7 @@ namespace CapMachine.Wpf.Services
/// </summary>
public class CanDriveService : BindableBase
{
public HighSpeedDataService HighSpeedDataService { get; }
/// <summary>
@@ -127,7 +128,7 @@ namespace CapMachine.Wpf.Services
break;
}
//添加到发送数据集合
CmdData.Add(SendCanCmdData);
CmdData.Add(SendCanCmdData);
}
@@ -142,7 +143,7 @@ namespace CapMachine.Wpf.Services
{
SpeedCanCmdData.SignalCmdValue = SpeedData;
}
if (EnableCanCmdData!=null)
if (EnableCanCmdData != null)
{
EnableCanCmdData.SignalCmdValue = 1;
}
@@ -231,6 +232,26 @@ namespace CapMachine.Wpf.Services
}
}
/// <summary>
/// 获取数据值
/// 从DBC中获取数据给数据中心集合
/// </summary>
/// <param name="Name"></param>
/// <returns></returns>
public double GetDbcValueByName(string Name)
{
if (!ToomossCanDrive.IsCycleRevice) return 0;
if (ListCanDbcModel.Any(a => a.Name == Name))
{
//double.TryParse(ListCanDbcModel.FindFirst(a => a.Name == Name).SignalRtValue, out double Result1);
return double.TryParse(ListCanDbcModel.FindFirst(a => a.Name == Name).SignalRtValue.Split(" ")[0], out double Result) == true ? Result : 0;
}
return 0;
}
#endregion