Added in ability to manually adjust the gcode time multiplier
This commit is contained in:
parent
aa35fd268b
commit
010b57649e
10 changed files with 40 additions and 9 deletions
|
|
@ -173,6 +173,7 @@ namespace MatterControl.Printing
|
|||
Vector4 maxAccelerationMmPerS2,
|
||||
Vector4 maxVelocityMmPerS,
|
||||
Vector4 velocitySameAsStopMmPerS,
|
||||
Vector4 speedMultiplier,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
if (FileTooBigToLoad(fileName))
|
||||
|
|
@ -184,7 +185,9 @@ namespace MatterControl.Printing
|
|||
return new GCodeMemoryFile(fileName,
|
||||
maxAccelerationMmPerS2,
|
||||
maxVelocityMmPerS,
|
||||
velocitySameAsStopMmPerS, cancellationToken);
|
||||
velocitySameAsStopMmPerS,
|
||||
speedMultiplier,
|
||||
cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -218,13 +221,15 @@ namespace MatterControl.Printing
|
|||
double feedRateMmPerMin,
|
||||
Vector4 maxAccelerationMmPerS2,
|
||||
Vector4 maxVelocityMmPerS,
|
||||
Vector4 velocitySameAsStopMmPerS)
|
||||
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);
|
||||
double speedMultiplier = speedMultiplierV4.X;
|
||||
|
||||
double distanceToMaxVelocity = GetDistanceToReachEndingVelocity(startingVelocityMmPerS, maxVelocityMmPerSx, acceleration);
|
||||
if (distanceToMaxVelocity <= lengthOfThisMoveMm / 2)
|
||||
|
|
@ -232,13 +237,13 @@ namespace MatterControl.Printing
|
|||
// we will reach max velocity then run at it and then decelerate
|
||||
double accelerationTime = GetTimeToAccelerateDistance(startingVelocityMmPerS, distanceToMaxVelocity, acceleration) * 2;
|
||||
double runningTime = (lengthOfThisMoveMm - (distanceToMaxVelocity * 2)) / maxVelocityMmPerSx;
|
||||
return accelerationTime + runningTime;
|
||||
return (accelerationTime + runningTime) * speedMultiplier;
|
||||
}
|
||||
else
|
||||
{
|
||||
// we will accelerate to the center then decelerate
|
||||
double accelerationTime = GetTimeToAccelerateDistance(startingVelocityMmPerS, lengthOfThisMoveMm / 2, acceleration) * 2;
|
||||
return accelerationTime;
|
||||
return (accelerationTime) * speedMultiplier;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ namespace MatterControl.Printing
|
|||
Vector4 maxAccelerationMmPerS2,
|
||||
Vector4 maxVelocityMmPerS,
|
||||
Vector4 velocitySameAsStopMmPerS,
|
||||
Vector4 speedMultiplier,
|
||||
CancellationToken cancellationToken, bool gcodeHasExplicitLayerChangeInfo = false)
|
||||
{
|
||||
this.gcodeHasExplicitLayerChangeInfo = gcodeHasExplicitLayerChangeInfo;
|
||||
|
|
@ -72,6 +73,7 @@ namespace MatterControl.Printing
|
|||
maxAccelerationMmPerS2,
|
||||
maxVelocityMmPerS,
|
||||
velocitySameAsStopMmPerS,
|
||||
speedMultiplier,
|
||||
cancellationToken, null);
|
||||
if (loadedFile != null)
|
||||
{
|
||||
|
|
@ -119,16 +121,18 @@ namespace MatterControl.Printing
|
|||
Vector4 maxAccelerationMmPerS2,
|
||||
Vector4 maxVelocityMmPerS,
|
||||
Vector4 velocitySameAsStopMmPerS,
|
||||
Vector4 speedMultiplier,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return ParseFileContents(gcodeContents,
|
||||
maxAccelerationMmPerS2, maxVelocityMmPerS, velocitySameAsStopMmPerS, cancellationToken, null);
|
||||
maxAccelerationMmPerS2, maxVelocityMmPerS, velocitySameAsStopMmPerS, speedMultiplier, cancellationToken, null);
|
||||
}
|
||||
|
||||
public static GCodeMemoryFile Load(Stream fileStream,
|
||||
Vector4 maxAccelerationMmPerS2,
|
||||
Vector4 maxVelocityMmPerS,
|
||||
Vector4 velocitySameAsStopMmPerS,
|
||||
Vector4 speedMultiplier,
|
||||
CancellationToken cancellationToken,
|
||||
Action<double, string> progressReporter = null)
|
||||
{
|
||||
|
|
@ -137,7 +141,7 @@ namespace MatterControl.Printing
|
|||
using (var reader = new StreamReader(fileStream))
|
||||
{
|
||||
return ParseFileContents(reader.ReadToEnd(),
|
||||
maxAccelerationMmPerS2, maxVelocityMmPerS, velocitySameAsStopMmPerS,
|
||||
maxAccelerationMmPerS2, maxVelocityMmPerS, velocitySameAsStopMmPerS, speedMultiplier,
|
||||
cancellationToken, progressReporter);
|
||||
}
|
||||
}
|
||||
|
|
@ -153,6 +157,7 @@ namespace MatterControl.Printing
|
|||
Vector4 maxAccelerationMmPerS2,
|
||||
Vector4 maxVelocityMmPerS,
|
||||
Vector4 velocitySameAsStopMmPerS,
|
||||
Vector4 speedMultiplier,
|
||||
CancellationToken cancellationToken, Action<double, string> progressReporter)
|
||||
{
|
||||
if (Path.GetExtension(filePath).ToUpper() == ".GCODE")
|
||||
|
|
@ -165,6 +170,7 @@ namespace MatterControl.Printing
|
|||
maxAccelerationMmPerS2,
|
||||
maxVelocityMmPerS,
|
||||
velocitySameAsStopMmPerS,
|
||||
speedMultiplier,
|
||||
cancellationToken, progressReporter);
|
||||
}
|
||||
}
|
||||
|
|
@ -211,6 +217,7 @@ namespace MatterControl.Printing
|
|||
Vector4 maxAccelerationMmPerS2,
|
||||
Vector4 maxVelocityMmPerS,
|
||||
Vector4 velocitySameAsStopMmPerS,
|
||||
Vector4 speedMultiplier,
|
||||
CancellationToken cancellationToken, Action<double, string> progressReporter)
|
||||
{
|
||||
if (gCodeString == null)
|
||||
|
|
@ -306,7 +313,8 @@ namespace MatterControl.Printing
|
|||
loadedGCodeFile.AnalyzeGCodeLines(cancellationToken, progressReporter,
|
||||
maxAccelerationMmPerS2,
|
||||
maxVelocityMmPerS,
|
||||
velocitySameAsStopMmPerS);
|
||||
velocitySameAsStopMmPerS,
|
||||
speedMultiplier);
|
||||
|
||||
loadTime.Stop();
|
||||
Console.WriteLine("Time To Load Seconds: {0:0.00}".FormatWith(loadTime.Elapsed.TotalSeconds));
|
||||
|
|
@ -317,7 +325,8 @@ namespace MatterControl.Printing
|
|||
private void AnalyzeGCodeLines(CancellationToken cancellationToken, Action<double, string> progressReporter,
|
||||
Vector4 maxAccelerationMmPerS2,
|
||||
Vector4 maxVelocityMmPerS,
|
||||
Vector4 velocitySameAsStopMmPerS)
|
||||
Vector4 velocitySameAsStopMmPerS,
|
||||
Vector4 speedMultiplier)
|
||||
{
|
||||
double feedRateMmPerMin = 0;
|
||||
Vector3 lastPrinterPosition = new Vector3();
|
||||
|
|
@ -367,7 +376,7 @@ namespace MatterControl.Printing
|
|||
if (feedRateMmPerMin > 0)
|
||||
{
|
||||
instruction.secondsThisLine = (float)GetSecondsThisLine(deltaPositionThisLine, deltaEPositionThisLine, feedRateMmPerMin,
|
||||
maxAccelerationMmPerS2, maxVelocityMmPerS, velocitySameAsStopMmPerS);
|
||||
maxAccelerationMmPerS2, maxVelocityMmPerS, velocitySameAsStopMmPerS, speedMultiplier);
|
||||
}
|
||||
|
||||
if (progressReporter != null && maxProgressReport.ElapsedMilliseconds > 200)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue