增加了CAN调度表发送,但是没有测试成功
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using CapMachine.Model.CANLIN;
|
||||
using CapMachine.Wpf.CanDrive;
|
||||
using CapMachine.Wpf.Dtos;
|
||||
using ImTools;
|
||||
using Prism.Ioc;
|
||||
using Prism.Mvvm;
|
||||
@@ -126,6 +127,11 @@ namespace CapMachine.Wpf.Services
|
||||
/// </summary>
|
||||
public List<CanCmdData> CmdData { get; set; } = new List<CanCmdData>();
|
||||
|
||||
/// <summary>
|
||||
/// CNA 调度表的配置信息
|
||||
/// </summary>
|
||||
public List<CANScheduleConfigDto> ListCANScheduleConfig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 增加发送的指令数据
|
||||
/// </summary>
|
||||
@@ -307,10 +313,39 @@ namespace CapMachine.Wpf.Services
|
||||
{
|
||||
if (CmdData.Count > 0)
|
||||
{
|
||||
ToomossCanDrive.IsCycleSend = true;
|
||||
|
||||
ToomossCanDrive.CmdData = CmdData;
|
||||
//ToomossCanDrive.StartCycleSendMsg();
|
||||
ToomossCanDrive.StartPrecisionCycleSendMsg();
|
||||
ToomossCanDrive.SchEnable = true;
|
||||
|
||||
if (ToomossCanDrive.SchEnable)
|
||||
{
|
||||
|
||||
//使用调度表的话,需要在调度表中配置信息后才可以进行操作
|
||||
var GroupMsg = ToomossCanDrive.CmdData.GroupBy(a => a.MsgName).ToList();
|
||||
foreach (var itemMsg in GroupMsg)
|
||||
{
|
||||
if (!ListCANScheduleConfig.ToList().Any(a => a.MsgName == itemMsg.Key))
|
||||
{
|
||||
System.Windows.MessageBox.Show($"你使能了调度表,但是调度表中没有设置【{itemMsg.Key}】信息,请设置后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ListCANScheduleConfig == null && ListCANScheduleConfig!.Count() == 0)
|
||||
{
|
||||
System.Windows.MessageBox.Show("调度表配置为空数据,请检查!将无法发送数据", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
return;
|
||||
}
|
||||
ToomossCanDrive.ListCANScheduleConfig = ListCANScheduleConfig!;
|
||||
ToomossCanDrive.StartSchedule();
|
||||
ToomossCanDrive.StartCycleUpdateCmd();
|
||||
}
|
||||
else
|
||||
{
|
||||
ToomossCanDrive.StartCycleSendMsg();
|
||||
}
|
||||
|
||||
ToomossCanDrive.IsCycleSend = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -319,7 +354,15 @@ namespace CapMachine.Wpf.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
ToomossCanDrive.IsCycleSend = false;
|
||||
if (ToomossCanDrive.SchEnable)
|
||||
{
|
||||
ToomossCanDrive.IsCycleSend = false;
|
||||
ToomossCanDrive.StopSchedule();
|
||||
}
|
||||
else
|
||||
{
|
||||
ToomossCanDrive.IsCycleSend = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -388,7 +431,7 @@ namespace CapMachine.Wpf.Services
|
||||
//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 double.TryParse(ListCanDbcModel.FindFirst(a => a.Name == Name).SignalRtValue.Split(" ")[0], out double Result) == true ? Result : 0;
|
||||
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user