diff --git a/ApplicationView/PrinterModels.cs b/ApplicationView/PrinterModels.cs index 61235c2d9..af12fd7ab 100644 --- a/ApplicationView/PrinterModels.cs +++ b/ApplicationView/PrinterModels.cs @@ -429,11 +429,13 @@ namespace MatterHackers.MatterControl var maxAcceleration = settings.GetValue(SettingsKey.max_acceleration); var maxVelocity = settings.GetValue(SettingsKey.max_velocity); var jerkVelocity = settings.GetValue(SettingsKey.jerk_velocity); + var multiplier = settings.GetValue(SettingsKey.print_time_estimate_multiplier) / 100.0; var loadedGCode = GCodeMemoryFile.Load(stream, new Vector4(maxAcceleration, maxAcceleration, maxAcceleration, maxAcceleration), new Vector4(maxVelocity, maxVelocity, maxVelocity, maxVelocity), new Vector4(jerkVelocity, jerkVelocity, jerkVelocity, jerkVelocity), + new Vector4(multiplier, multiplier, multiplier, multiplier), cancellationToken, progressReporter); this.GCodeRenderer = new GCodeRenderer(loadedGCode); this.RenderInfo = new GCodeRenderInfo( diff --git a/Library/Export/GCodeExport.cs b/Library/Export/GCodeExport.cs index 4eee5c959..25e74c415 100644 --- a/Library/Export/GCodeExport.cs +++ b/Library/Export/GCodeExport.cs @@ -154,6 +154,7 @@ namespace MatterHackers.MatterControl.Library.Export new Vector4(), new Vector4(), new Vector4(), + Vector4.One, CancellationToken.None)); var printerSettings = ActiveSliceSettings.Instance; diff --git a/MatterControl.Printing/GCode/GCodeFile.cs b/MatterControl.Printing/GCode/GCodeFile.cs index 71f243e92..153ea6654 100644 --- a/MatterControl.Printing/GCode/GCodeFile.cs +++ b/MatterControl.Printing/GCode/GCodeFile.cs @@ -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; } } diff --git a/MatterControl.Printing/GCode/GCodeMemoryFile.cs b/MatterControl.Printing/GCode/GCodeMemoryFile.cs index 797d164c8..d40a3cd8c 100644 --- a/MatterControl.Printing/GCode/GCodeMemoryFile.cs +++ b/MatterControl.Printing/GCode/GCodeMemoryFile.cs @@ -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 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 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 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 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) diff --git a/PrinterCommunication/PrinterConnection.cs b/PrinterCommunication/PrinterConnection.cs index c7978ca91..efd279ad4 100644 --- a/PrinterCommunication/PrinterConnection.cs +++ b/PrinterCommunication/PrinterConnection.cs @@ -2151,6 +2151,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication new Vector4(), new Vector4(), new Vector4(), + Vector4.One, CancellationToken.None)); if (this.RecoveryIsEnabled diff --git a/Queue/OptionsMenu/ExportToFolderProcess.cs b/Queue/OptionsMenu/ExportToFolderProcess.cs index f07722229..e41a60da0 100644 --- a/Queue/OptionsMenu/ExportToFolderProcess.cs +++ b/Queue/OptionsMenu/ExportToFolderProcess.cs @@ -182,6 +182,7 @@ namespace MatterHackers.MatterControl.PrintQueue new Vector4(), new Vector4(), new Vector4(), + Vector4.One, CancellationToken.None); for (int j = 0; j < unleveledGCode.LineCount; j++) diff --git a/SlicerConfiguration/Settings/SettingsHelpers.cs b/SlicerConfiguration/Settings/SettingsHelpers.cs index c99c4aec4..2feaf35b4 100644 --- a/SlicerConfiguration/Settings/SettingsHelpers.cs +++ b/SlicerConfiguration/Settings/SettingsHelpers.cs @@ -97,6 +97,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration public const string ip_address = nameof(ip_address); public const string ip_port = nameof(ip_port); public const string jerk_velocity = nameof(jerk_velocity); + public const string print_time_estimate_multiplier = nameof(print_time_estimate_multiplier); public const string laser_speed_025 = nameof(laser_speed_025); public const string laser_speed_100 = nameof(laser_speed_100); public const string layer_gcode = nameof(layer_gcode); diff --git a/SlicerConfiguration/SlicerMapping/SliceEngineMapping.cs b/SlicerConfiguration/SlicerMapping/SliceEngineMapping.cs index bd866cd34..4bdddd50c 100644 --- a/SlicerConfiguration/SlicerMapping/SliceEngineMapping.cs +++ b/SlicerConfiguration/SlicerMapping/SliceEngineMapping.cs @@ -101,6 +101,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration SettingsKey.enable_sailfish_communication, SettingsKey.max_velocity, SettingsKey.jerk_velocity, + SettingsKey.print_time_estimate_multiplier, SettingsKey.max_acceleration, SettingsKey.ip_address, SettingsKey.ip_port, diff --git a/StaticData/SliceSettings/Layouts.txt b/StaticData/SliceSettings/Layouts.txt index e0e51a197..98ec4a932 100644 --- a/StaticData/SliceSettings/Layouts.txt +++ b/StaticData/SliceSettings/Layouts.txt @@ -191,6 +191,7 @@ Printer max_acceleration max_velocity jerk_velocity + print_time_estimate_multiplier Slicing Slicing Options output_only_first_layer diff --git a/StaticData/SliceSettings/Properties.json b/StaticData/SliceSettings/Properties.json index 59e513565..74d3737b1 100644 --- a/StaticData/SliceSettings/Properties.json +++ b/StaticData/SliceSettings/Properties.json @@ -1905,6 +1905,15 @@ "Units": "mm/s", "RebuildGCodeOnChange": false }, + { + "SlicerConfigName": "print_time_estimate_multiplier", + "PresentationName": "Time Multiplier", + "HelpText": "Adjust this to correct differences between expected printing speeds and actual printing speeds.", + "DataEditType": "POSITIVE_DOUBLE", + "Units": "%", + "ShowIfSet": "!sla_printer", + "DefaultValue": "100" + }, { "SlicerConfigName": "manual_movement_speeds", "PresentationName": "Manual Movement Speeds",