现场更改4
This commit is contained in:
7
.claude/settings.local.json
Normal file
7
.claude/settings.local.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"permissions": {
|
||||||
|
"allow": [
|
||||||
|
"mcp__filesystem__directory_tree"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -546,7 +546,6 @@ namespace CapMachine.Wpf.CanDrive
|
|||||||
Marshal.FreeHGlobal(msgPtSend);
|
Marshal.FreeHGlobal(msgPtSend);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Console.WriteLine("");
|
|
||||||
//发送CAN数据
|
//发送CAN数据
|
||||||
int SendedNum = USB2CAN.CAN_SendMsg(DevHandle, WriteCANIndex, CanMsg, (uint)CanMsg.Length);
|
int SendedNum = USB2CAN.CAN_SendMsg(DevHandle, WriteCANIndex, CanMsg, (uint)CanMsg.Length);
|
||||||
if (SendedNum >= 0)
|
if (SendedNum >= 0)
|
||||||
@@ -594,7 +593,6 @@ namespace CapMachine.Wpf.CanDrive
|
|||||||
int CanNum = USB2CAN.CAN_GetMsgWithSize(DevHandle, ReadCANIndex, msgPtRead, CanMsgBuffer.Length);
|
int CanNum = USB2CAN.CAN_GetMsgWithSize(DevHandle, ReadCANIndex, msgPtRead, CanMsgBuffer.Length);
|
||||||
if (CanNum > 0)
|
if (CanNum > 0)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Read CanMsgNum = {0}", CanNum);
|
|
||||||
for (int i = 0; i < CanNum; i++)
|
for (int i = 0; i < CanNum; i++)
|
||||||
{
|
{
|
||||||
//CanMsgBuffer[i] = (USB2CAN.CAN_MSG)Marshal.PtrToStructure((IntPtr)((UInt32)msgPtRead + i * Marshal.SizeOf(typeof(USB2CAN.CAN_MSG))), typeof(USB2CAN.CAN_MSG)); //有溢出报错
|
//CanMsgBuffer[i] = (USB2CAN.CAN_MSG)Marshal.PtrToStructure((IntPtr)((UInt32)msgPtRead + i * Marshal.SizeOf(typeof(USB2CAN.CAN_MSG))), typeof(USB2CAN.CAN_MSG)); //有溢出报错
|
||||||
@@ -603,10 +601,6 @@ namespace CapMachine.Wpf.CanDrive
|
|||||||
//Console.WriteLine("CanMsg[{0}].ID = 0x{1}", i, CanMsgBuffer[i].ID.ToString("X8"));
|
//Console.WriteLine("CanMsg[{0}].ID = 0x{1}", i, CanMsgBuffer[i].ID.ToString("X8"));
|
||||||
//Console.WriteLine("CanMsg[{0}].TimeStamp = {1}", i, CanMsgBuffer[i].TimeStamp);
|
//Console.WriteLine("CanMsg[{0}].TimeStamp = {1}", i, CanMsgBuffer[i].TimeStamp);
|
||||||
//Console.Write("CanMsg[{0}].Data = ", i);
|
//Console.Write("CanMsg[{0}].Data = ", i);
|
||||||
for (int j = 0; j < CanMsgBuffer[i].DataLen; j++)
|
|
||||||
{
|
|
||||||
Console.Write("{0} ", CanMsgBuffer[i].Data[j].ToString("X2"));
|
|
||||||
}
|
|
||||||
//Console.WriteLine("");
|
//Console.WriteLine("");
|
||||||
|
|
||||||
//报文给高速记录的服务
|
//报文给高速记录的服务
|
||||||
@@ -627,8 +621,6 @@ namespace CapMachine.Wpf.CanDrive
|
|||||||
{
|
{
|
||||||
//Console.WriteLine("Get CAN data error!");
|
//Console.WriteLine("Get CAN data error!");
|
||||||
}
|
}
|
||||||
Console.WriteLine("");
|
|
||||||
|
|
||||||
if (CanNum > 0)
|
if (CanNum > 0)
|
||||||
{
|
{
|
||||||
lock (_dbcParserLock)
|
lock (_dbcParserLock)
|
||||||
@@ -645,7 +637,6 @@ namespace CapMachine.Wpf.CanDrive
|
|||||||
var valueSb = new StringBuilder(64);
|
var valueSb = new StringBuilder(64);
|
||||||
CAN_DBCParser.DBC_GetSignalValueStr(DBCHandle, new StringBuilder(item.MsgName), new StringBuilder(item.SignalName), valueSb);
|
CAN_DBCParser.DBC_GetSignalValueStr(DBCHandle, new StringBuilder(item.MsgName), new StringBuilder(item.SignalName), valueSb);
|
||||||
item.SignalRtValueSb = valueSb;
|
item.SignalRtValueSb = valueSb;
|
||||||
Console.Write(valueSb.ToString());
|
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -717,7 +708,7 @@ namespace CapMachine.Wpf.CanDrive
|
|||||||
CycleSendCts = cancellationTokenSource;//将取消标记源保存到类的成员变量CycleSendCts,这样在外部调用停止方法时可以访问它
|
CycleSendCts = cancellationTokenSource;//将取消标记源保存到类的成员变量CycleSendCts,这样在外部调用停止方法时可以访问它
|
||||||
NextExecutionTime = 0;//初始化NextExecutionTime为0,这个变量用于记录下一次执行的目标时间点
|
NextExecutionTime = 0;//初始化NextExecutionTime为0,这个变量用于记录下一次执行的目标时间点
|
||||||
|
|
||||||
CycleSendTask = Task.Factory.StartNew(async () =>
|
CycleSendTask = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -863,7 +854,7 @@ namespace CapMachine.Wpf.CanDrive
|
|||||||
Stopwatcher.Stop();
|
Stopwatcher.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
}, token, TaskCreationOptions.LongRunning, TaskScheduler.Default);
|
}, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -255,10 +255,10 @@ namespace CapMachine.Wpf.Services
|
|||||||
{
|
{
|
||||||
if (!ToomossCanDrive.IsCycleRevice) return 0;
|
if (!ToomossCanDrive.IsCycleRevice) return 0;
|
||||||
|
|
||||||
if (ListCanDbcModel.Any(a => a.Name == Name))
|
var dbcModel = ListCanDbcModel.FindFirst(a => a.Name == Name);
|
||||||
|
if (dbcModel != null && !string.IsNullOrWhiteSpace(dbcModel.SignalRtValue))
|
||||||
{
|
{
|
||||||
//double.TryParse(ListCanDbcModel.FindFirst(a => a.Name == Name).SignalRtValue, out double Result1);
|
return double.TryParse(dbcModel.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;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -274,10 +274,10 @@ namespace CapMachine.Wpf.Services
|
|||||||
{
|
{
|
||||||
if (!ToomossCanDrive.IsCycleRevice) return 0;
|
if (!ToomossCanDrive.IsCycleRevice) return 0;
|
||||||
|
|
||||||
if (ListCanDbcModel.Any(a => a.Name == Name))
|
var dbcModel = ListCanDbcModel.FindFirst(a => a.Name == Name);
|
||||||
|
if (dbcModel != null && !string.IsNullOrWhiteSpace(dbcModel.SignalRtValue))
|
||||||
{
|
{
|
||||||
//double.TryParse(ListCanDbcModel.FindFirst(a => a.Name == Name).SignalRtValue, out double Result1);
|
return double.TryParse(dbcModel.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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user