CAN的更改

This commit is contained in:
2025-05-09 16:13:11 +08:00
parent df4b481bbb
commit 03fd92ac86
8 changed files with 176 additions and 131 deletions

View File

@@ -618,7 +618,7 @@ namespace CapMachine.Wpf.CanDrive
// 预先计算固定值
long CycleInTicks = (long)(SendCycle * TicksPerMs);
//临时测试用
long lastTicks = Stopwatcher.ElapsedTicks;
//long lastTicks = Stopwatcher.ElapsedTicks;
//IsCycleSend
while (IsCycleSend && !token.IsCancellationRequested)
{
@@ -664,8 +664,9 @@ namespace CapMachine.Wpf.CanDrive
}
// 使用Stopwatch记录实际的执行间隔而不是DateTime
Console.WriteLine($"--实际间隔(ms): {(Stopwatcher.ElapsedTicks - lastTicks) / TicksPerMs:F3}, 目标: {SendCycle}");
lastTicks = Stopwatcher.ElapsedTicks;
//Console.WriteLine($"--实际间隔(ms): {(Stopwatcher.ElapsedTicks - lastTicks) / TicksPerMs:F3}, 目标: {SendCycle}");
//lastTicks = Stopwatcher.ElapsedTicks;
//Console.WriteLine($"--当前时间(毫秒): {DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}");