From 2ead63000f520aade0a2862247c48f630437050b Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Wed, 7 Feb 2018 12:48:57 -0800 Subject: [PATCH] Improved the math around gcode time and jerk setting --- MatterControl.Printing/GCode/GCodeFile.cs | 14 ++++++++++---- Submodules/agg-sharp | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/MatterControl.Printing/GCode/GCodeFile.cs b/MatterControl.Printing/GCode/GCodeFile.cs index 153ea6654..912e64158 100644 --- a/MatterControl.Printing/GCode/GCodeFile.cs +++ b/MatterControl.Printing/GCode/GCodeFile.cs @@ -224,11 +224,17 @@ namespace MatterControl.Printing Vector4 velocitySameAsStopMmPerS, Vector4 speedMultiplierV4) { - double startingVelocityMmPerS = velocitySameAsStopMmPerS.X; - double endingVelocityMmPerS = velocitySameAsStopMmPerS.X; - double maxVelocityMmPerSx = Math.Min(feedRateMmPerMin / 60, maxVelocityMmPerS.X); - double acceleration = maxAccelerationMmPerS2.X; double lengthOfThisMoveMm = Math.Max(deltaPositionThisLine.Length, deltaEPositionThisLine); + + if (lengthOfThisMoveMm == 0) + { + return 0; + } + + double maxVelocityMmPerSx = Math.Min(feedRateMmPerMin / 60, maxVelocityMmPerS.X); + double startingVelocityMmPerS = Math.Min(velocitySameAsStopMmPerS.X, maxVelocityMmPerSx); + double endingVelocityMmPerS = startingVelocityMmPerS; + double acceleration = maxAccelerationMmPerS2.X; double speedMultiplier = speedMultiplierV4.X; double distanceToMaxVelocity = GetDistanceToReachEndingVelocity(startingVelocityMmPerS, maxVelocityMmPerSx, acceleration); diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index f0ae8affb..2932cc92a 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit f0ae8affbd243e7969eca8078db7a17daa19a1a6 +Subproject commit 2932cc92a8d67fcfe5bbff3c762b1c43ec700ede