Working on resuming for non-max z printers
Added settings to support resuming Save the baby step offset for print resuming Make sure we don't resume prints that are not started Refactoring
This commit is contained in:
parent
9f9d3803a3
commit
ea89d41bc6
12 changed files with 157 additions and 63 deletions
|
|
@ -38,6 +38,7 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.DataStorage
|
||||
{
|
||||
|
|
@ -360,6 +361,9 @@ namespace MatterHackers.MatterControl.DataStorage
|
|||
}
|
||||
|
||||
public int PrintTimeSeconds { get; set; }
|
||||
public float PrintingOffsetX { get; set; }
|
||||
public float PrintingOffsetY { get; set; }
|
||||
public float PrintingOffsetZ { get; set; }
|
||||
|
||||
public override void Commit()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ using MatterHackers.Localizations;
|
|||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.PrinterCommunication;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
|
@ -53,8 +54,10 @@ namespace MatterHackers.MatterControl.PrintHistory
|
|||
{
|
||||
if (!lastPrint.PrintComplete // Top Print History Item is not complete
|
||||
&& !string.IsNullOrEmpty(lastPrint.PrintingGCodeFileName) // PrintingGCodeFileName is set
|
||||
&& File.Exists(lastPrint.PrintingGCodeFileName)) // PrintingGCodeFileName is still on disk
|
||||
{
|
||||
&& File.Exists(lastPrint.PrintingGCodeFileName) // PrintingGCodeFileName is still on disk
|
||||
&& lastPrint.PercentDone > 0 // we are actually part way into the print
|
||||
&& ActiveSliceSettings.Instance.GetActiveValue("has_hardware_leveling") == "0")
|
||||
{
|
||||
lastPrintTask = lastPrint;
|
||||
StyledMessageBox.ShowMessageBox(ResumeFailedPrintProcessDialogResponse, resumeFailedPrintMessage, resumeFailedPrintTitle, StyledMessageBox.MessageType.YES_NO, resumePrint, cancelResume);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,13 +41,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
MaxLengthStream maxLengthStream;
|
||||
int layerCount = -1;
|
||||
|
||||
public Vector3 Offset
|
||||
{
|
||||
get
|
||||
{
|
||||
return offsetStream.Offset;
|
||||
}
|
||||
}
|
||||
public Vector3 Offset { get { return offsetStream.Offset; } set { offsetStream.Offset = value; } }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ using MatterHackers.GCodeVisualizer;
|
|||
using MatterHackers.Agg;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.MatterControl.PrinterControls;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
||||
{
|
||||
|
|
@ -90,7 +91,22 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
|
||||
// if top homing, home the extruder
|
||||
case ResumeState.Homing:
|
||||
queuedCommands.Add("G28");
|
||||
if (ActiveSliceSettings.Instance.GetActiveValue("z_homes_to_max") == "1")
|
||||
{
|
||||
queuedCommands.Add("G28");
|
||||
}
|
||||
else
|
||||
{
|
||||
// home x
|
||||
queuedCommands.Add("G28 X0");
|
||||
// home y
|
||||
queuedCommands.Add("G28 Y0");
|
||||
// move to the place we can home z from
|
||||
Vector2 resumePositionXy = ActiveSliceSettings.Instance.GetActiveVector2("resume_position_before_z_home");
|
||||
queuedCommands.Add("G1 X{0:0.000}Y{1:0.000}F{2}".FormatWith(resumePositionXy.x, resumePositionXy.y, MovementControls.XSpeed));
|
||||
// home z
|
||||
queuedCommands.Add("G28 Z0");
|
||||
}
|
||||
resumeState = ResumeState.FindingResumeLayer;
|
||||
return "";
|
||||
|
||||
|
|
@ -134,33 +150,54 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
return "";
|
||||
|
||||
case ResumeState.PrimingAndMovingToStart:
|
||||
// let's prime the extruder move to a good position over the part then start printing
|
||||
queuedCommands.Add("G1 E5");
|
||||
queuedCommands.Add("G1 E4");
|
||||
queuedCommands.Add(CreateMovementLine(new PrinterMove(lastDestination.position + new VectorMath.Vector3(0, 0, 5), 0, MovementControls.ZSpeed)));
|
||||
queuedCommands.Add("G1 E5");
|
||||
queuedCommands.Add("G92 E{0}".FormatWith(lastDestination.extrusion));
|
||||
resumeState = ResumeState.PrintingSlow;
|
||||
{
|
||||
// let's prime the extruder, move to a good position over the part, then start printing
|
||||
queuedCommands.Add("G1 E5");
|
||||
queuedCommands.Add("G1 E4");
|
||||
if (ActiveSliceSettings.Instance.GetActiveValue("z_homes_to_max") == "0") // we are homed to the bed
|
||||
{
|
||||
// move to the height we can resume printing from
|
||||
Vector2 resumePositionXy = ActiveSliceSettings.Instance.GetActiveVector2("resume_position_before_z_home");
|
||||
queuedCommands.Add(CreateMovementLine(new PrinterMove(new VectorMath.Vector3(resumePositionXy.x, resumePositionXy.y, lastDestination.position.z + 5), 0, MovementControls.ZSpeed)));
|
||||
// move just above the actual print position
|
||||
queuedCommands.Add(CreateMovementLine(new PrinterMove(lastDestination.position + new VectorMath.Vector3(0, 0, 5), 0, MovementControls.XSpeed)));
|
||||
// move down to part
|
||||
queuedCommands.Add(CreateMovementLine(new PrinterMove(lastDestination.position, 0, MovementControls.ZSpeed)));
|
||||
}
|
||||
else
|
||||
{
|
||||
// move to the actual print position
|
||||
queuedCommands.Add(CreateMovementLine(new PrinterMove(lastDestination.position, 0, MovementControls.ZSpeed)));
|
||||
}
|
||||
// extrude back to our filament start
|
||||
queuedCommands.Add("G1 E5");
|
||||
/// reset the printer to know where it the filament should be
|
||||
queuedCommands.Add("G92 E{0}".FormatWith(lastDestination.extrusion));
|
||||
resumeState = ResumeState.PrintingSlow;
|
||||
}
|
||||
return "";
|
||||
|
||||
case ResumeState.PrintingSlow:
|
||||
string lineToSend = gCodeFileStream0.ReadLine();
|
||||
if(!lineToSend.StartsWith("; LAYER:"))
|
||||
if (false)
|
||||
{
|
||||
if (lineToSend != null
|
||||
&& LineIsMovement(lineToSend))
|
||||
string lineToSend = gCodeFileStream0.ReadLine();
|
||||
if (!lineToSend.StartsWith("; LAYER:"))
|
||||
{
|
||||
PrinterMove currentMove = GetPosition(lineToSend, lastDestination);
|
||||
PrinterMove moveToSend = currentMove;
|
||||
double feedRate = ActiveSliceSettings.Instance.GetActiveValueAsDouble("first_resume_layer_speed", 10) * 60;
|
||||
moveToSend.feedRate = feedRate;
|
||||
if (lineToSend != null
|
||||
&& LineIsMovement(lineToSend))
|
||||
{
|
||||
PrinterMove currentMove = GetPosition(lineToSend, lastDestination);
|
||||
PrinterMove moveToSend = currentMove;
|
||||
double feedRate = ActiveSliceSettings.Instance.GetActiveValueAsDouble("resume_first_layer_speed", 10) * 60;
|
||||
moveToSend.feedRate = feedRate;
|
||||
|
||||
lineToSend = CreateMovementLine(moveToSend, lastDestination);
|
||||
lastDestination = currentMove;
|
||||
return lineToSend;
|
||||
}
|
||||
|
||||
lineToSend = CreateMovementLine(moveToSend, lastDestination);
|
||||
lastDestination = currentMove;
|
||||
return lineToSend;
|
||||
}
|
||||
|
||||
return lineToSend;
|
||||
}
|
||||
|
||||
resumeState = ResumeState.PrintingToEnd;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
|
|||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.PrinterCommunication.Io;
|
||||
using MatterHackers.MatterControl.PrintHistory;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.SerialPortCommunication;
|
||||
|
|
@ -45,7 +44,6 @@ using MatterHackers.VectorMath;
|
|||
using Microsoft.Win32.SafeHandles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
|
@ -2460,6 +2458,11 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
printLevelingStream4 = new PrintLevelingStream(relativeToAbsoluteStream3);
|
||||
waitForTempStream5 = new WaitForTempStream(printLevelingStream4);
|
||||
babyStepsStream6 = new BabyStepsStream(waitForTempStream5);
|
||||
if(activePrintTask != null)
|
||||
{
|
||||
// make sure we are in the position we were when we stopped printing
|
||||
babyStepsStream6.Offset = new Vector3(activePrintTask.PrintingOffsetX, activePrintTask.PrintingOffsetY, activePrintTask.PrintingOffsetZ);
|
||||
}
|
||||
extrusionMultiplyerStream7 = new ExtrusionMultiplyerStream(babyStepsStream6);
|
||||
feedrateMultiplyerStream8 = new FeedRateMultiplyerStream(extrusionMultiplyerStream7);
|
||||
requestTemperaturesStream9 = new RequestTemperaturesStream(feedrateMultiplyerStream8);
|
||||
|
|
@ -2746,10 +2749,12 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|| secondsSinceUpdateHistory + 1 < secondsSinceStartedPrint)
|
||||
{
|
||||
activePrintTask.PercentDone = loadedGCode.PercentComplete(gCodeFileStream0.LineIndex);
|
||||
activePrintTask.Commit();
|
||||
activePrintTask.PrintingOffsetX = (float)babyStepsStream6.Offset.x;
|
||||
activePrintTask.PrintingOffsetY = (float)babyStepsStream6.Offset.y;
|
||||
activePrintTask.PrintingOffsetZ = (float)babyStepsStream6.Offset.z;
|
||||
activePrintTask.Commit();
|
||||
secondsSinceUpdateHistory = secondsSinceStartedPrint;
|
||||
Debug.WriteLine(activePrintTask.PercentDone.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
if (trimedLine.Length > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -975,7 +975,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
if (!ValidateGoodSpeedSettingGreaterThan0("bridge_speed", normalSpeedLocation)) return false;
|
||||
if (!ValidateGoodSpeedSettingGreaterThan0("external_perimeter_speed", normalSpeedLocation)) return false;
|
||||
if (!ValidateGoodSpeedSettingGreaterThan0("first_layer_speed", normalSpeedLocation)) return false;
|
||||
if (!ValidateGoodSpeedSettingGreaterThan0("first_resume_layer_speed", normalSpeedLocation)) return false;
|
||||
if (!ValidateGoodSpeedSettingGreaterThan0("resume_first_layer_speed", normalSpeedLocation)) return false;
|
||||
if (!ValidateGoodSpeedSettingGreaterThan0("gap_fill_speed", normalSpeedLocation)) return false;
|
||||
if (!ValidateGoodSpeedSettingGreaterThan0("infill_speed", normalSpeedLocation)) return false;
|
||||
if (!ValidateGoodSpeedSettingGreaterThan0("perimeter_speed", normalSpeedLocation)) return false;
|
||||
|
|
|
|||
|
|
@ -254,16 +254,16 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
private static List<string> settingToReloadUiWhenChanged = new List<string>()
|
||||
{
|
||||
"extruder_count",
|
||||
"extruders_share_temperature",
|
||||
"has_fan",
|
||||
"has_heated_bed",
|
||||
"print_leveling_required_to_print",
|
||||
"has_hardware_leveling",
|
||||
"has_sd_card_reader",
|
||||
"extruder_count",
|
||||
"show_reset_connection",
|
||||
"extruders_share_temperature",
|
||||
"center_part_on_bed",
|
||||
"has_hardware_leveling",
|
||||
"include_firmware_updater",
|
||||
"print_leveling_required_to_print",
|
||||
"show_reset_connection",
|
||||
};
|
||||
|
||||
private TextImageButtonFactory buttonFactory = new TextImageButtonFactory();
|
||||
|
|
@ -547,23 +547,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
foreach (OrganizerSettingsData settingInfo in subGroup.SettingDataList)
|
||||
{
|
||||
bool settingShouldBeShown = true;
|
||||
if (settingInfo.ShowIfSet != null
|
||||
&& settingInfo.ShowIfSet != "")
|
||||
{
|
||||
string showValue = "0";
|
||||
string checkName = settingInfo.ShowIfSet;
|
||||
if(checkName.StartsWith("!"))
|
||||
{
|
||||
showValue = "1";
|
||||
checkName = checkName.Substring(1);
|
||||
}
|
||||
string sliceSettingValue = ActiveSliceSettings.Instance.GetActiveValue(checkName);
|
||||
if (sliceSettingValue == showValue)
|
||||
{
|
||||
settingShouldBeShown = false;
|
||||
}
|
||||
}
|
||||
bool settingShouldBeShown = CheckIfShouldBeShown(settingInfo);
|
||||
|
||||
if (ActivePrinterProfile.Instance.ActiveSliceEngine.MapContains(settingInfo.SlicerConfigName)
|
||||
&& settingShouldBeShown)
|
||||
|
|
@ -649,6 +633,29 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
return groupTabs;
|
||||
}
|
||||
|
||||
private static bool CheckIfShouldBeShown(OrganizerSettingsData settingInfo)
|
||||
{
|
||||
bool settingShouldBeShown = true;
|
||||
if (settingInfo.ShowIfSet != null
|
||||
&& settingInfo.ShowIfSet != "")
|
||||
{
|
||||
string showValue = "0";
|
||||
string checkName = settingInfo.ShowIfSet;
|
||||
if (checkName.StartsWith("!"))
|
||||
{
|
||||
showValue = "1";
|
||||
checkName = checkName.Substring(1);
|
||||
}
|
||||
string sliceSettingValue = ActiveSliceSettings.Instance.GetActiveValue(checkName);
|
||||
if (sliceSettingValue == showValue)
|
||||
{
|
||||
settingShouldBeShown = false;
|
||||
}
|
||||
}
|
||||
|
||||
return settingShouldBeShown;
|
||||
}
|
||||
|
||||
private void AddInHelpText(FlowLayoutWidget topToBottomSettings, OrganizerSettingsData settingInfo)
|
||||
{
|
||||
FlowLayoutWidget allText = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
|
|
|
|||
|
|
@ -46,8 +46,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
"bed_size",
|
||||
"bed_temperature",
|
||||
"build_height",
|
||||
"first_resume_layer_speed",
|
||||
"cancel_gcode",
|
||||
"cancel_gcode",
|
||||
"connect_gcode",
|
||||
"has_fan",
|
||||
"has_hardware_leveling",
|
||||
|
|
@ -59,10 +58,13 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
"print_leveling_method",
|
||||
"print_leveling_required_to_print",
|
||||
"print_leveling_solution",
|
||||
"resume_first_layer_speed",
|
||||
"resume_position_before_z_home",
|
||||
"resume_gcode",
|
||||
"support_material_threshold",
|
||||
"temperature",
|
||||
"z_can_be_negative",
|
||||
"z_homes_to_max",
|
||||
|
||||
// TODO: merge the items below into the list above after some validation - setting that weren't previously mapped to Cura but probably should be.
|
||||
"bed_remove_part_temperature",
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ first_layer_extrusion_width = 100%
|
|||
first_layer_height = 0.5
|
||||
first_layer_speed = 30%
|
||||
first_layer_temperature = 205
|
||||
first_resume_layer_speed = 10
|
||||
g0 = 0
|
||||
gap_fill_speed = 20
|
||||
gcode_arcs = 0
|
||||
|
|
@ -106,7 +105,9 @@ randomize_start = 0
|
|||
repair_outlines_extensive_stitching = 0
|
||||
repair_outlines_keep_open = 0
|
||||
resolution = 0
|
||||
resume_first_layer_speed = 10
|
||||
resume_gcode =
|
||||
resume_position_before_z_home = 0,0
|
||||
retract_before_travel = 20
|
||||
retract_layer_change = 1
|
||||
retract_length = 1
|
||||
|
|
@ -169,4 +170,5 @@ wipe = 0
|
|||
wipe_shield_distance = 0
|
||||
wipe_tower_size = 0
|
||||
z_can_be_negative = 0
|
||||
z_homes_to_max = 1
|
||||
z_offset = 0
|
||||
|
|
|
|||
|
|
@ -115,7 +115,6 @@ Advanced
|
|||
travel_speed
|
||||
Modifiers
|
||||
first_layer_speed
|
||||
first_resume_layer_speed
|
||||
Acceleration Control
|
||||
perimeter_acceleration
|
||||
infill_acceleration
|
||||
|
|
@ -288,6 +287,12 @@ Advanced
|
|||
Probe Settings
|
||||
manual_probe_paper_width
|
||||
Options
|
||||
Resume Failed Print
|
||||
Speed
|
||||
resume_first_layer_speed
|
||||
Homing
|
||||
z_homes_to_max
|
||||
resume_position_before_z_home
|
||||
Custom G-Code
|
||||
Start G-Code
|
||||
start_gcode
|
||||
|
|
|
|||
|
|
@ -358,11 +358,28 @@
|
|||
"ExtraSettings": "mm/s or %"
|
||||
},
|
||||
{
|
||||
"SlicerConfigName": "first_resume_layer_speed",
|
||||
"SlicerConfigName": "resume_first_layer_speed",
|
||||
"PresentationName": "Resume Layer Speed",
|
||||
"HelpText": "The speed at which the nozzle will move when resuming a failed print, for 1 layer.",
|
||||
"DataEditType": "POSITIVE_DOUBLE",
|
||||
"ExtraSettings": "mm/s"
|
||||
"ExtraSettings": "mm/s",
|
||||
"ShowIfSet": "!has_hardware_leveling"
|
||||
},
|
||||
{
|
||||
"SlicerConfigName": "z_homes_to_max",
|
||||
"PresentationName": "Home Z Max",
|
||||
"HelpText": "Set if the z homing moves the extruder away from the bed (z-max homing)",
|
||||
"DataEditType": "CHECK_BOX",
|
||||
"ExtraSettings": "",
|
||||
"ShowIfSet": "!has_hardware_leveling"
|
||||
},
|
||||
{
|
||||
"SlicerConfigName": "resume_position_before_z_home",
|
||||
"PresentationName": "XY Resume Position",
|
||||
"HelpText": "The X and Y position of the extruder that minimizes the chance of colliding with the parts on the bed.",
|
||||
"DataEditType": "VECTOR2",
|
||||
"ExtraSettings": "mm",
|
||||
"ShowIfSet": "!has_hardware_leveling"
|
||||
},
|
||||
{
|
||||
"SlicerConfigName": "first_layer_temperature",
|
||||
|
|
|
|||
|
|
@ -4687,3 +4687,21 @@ Translated:The speed at which the nozzle will move when resuming a failed print,
|
|||
English:Resume Layer Speed
|
||||
Translated:Resume Layer Speed
|
||||
|
||||
English:Set if the z homing moves the extruder away from the bed (z-max homing)
|
||||
Translated:Set if the z homing moves the extruder away from the bed (z-max homing)
|
||||
|
||||
English:The X and Y position of the extruder that minimizes the chance of colliding with the parts on the bed.
|
||||
Translated:The X and Y position of the extruder that minimizes the chance of colliding with the parts on the bed.
|
||||
|
||||
English:Resume Failed Print
|
||||
Translated:Resume Failed Print
|
||||
|
||||
English:Home Z Max
|
||||
Translated:Home Z Max
|
||||
|
||||
English:XY Resume Position
|
||||
Translated:XY Resume Position
|
||||
|
||||
English:Homing
|
||||
Translated:Homing
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue