Get baby stepping working for extruder 2
Make sure load extruder 2 has load option Fixe bug with canceling probing then restarting right away issue: MatterHackers/MCCentral#4669 Way to babystep Dual extruder Z offset
This commit is contained in:
parent
449ff59de9
commit
26d6701809
16 changed files with 161 additions and 74 deletions
|
|
@ -48,7 +48,11 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
{
|
||||
if (e?.Data == SettingsKey.baby_step_z_offset)
|
||||
{
|
||||
OffsetChanged();
|
||||
offsetStream.RuntimeOffsets[0] = new Vector3(0, 0, printer.Settings.GetValue<double>(SettingsKey.baby_step_z_offset));
|
||||
}
|
||||
else if(e?.Data == SettingsKey.baby_step_z_offset_1)
|
||||
{
|
||||
offsetStream.RuntimeOffsets[1] = new Vector3(0, 0, printer.Settings.GetValue<double>(SettingsKey.baby_step_z_offset_1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -56,15 +60,13 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
printer.Disposed += (s, e) => printer.Settings.SettingChanged -= Printer_SettingChanged;
|
||||
|
||||
maxLengthStream = new MaxLengthStream(printer, internalStream, startingMaxLength);
|
||||
offsetStream = new OffsetStream(maxLengthStream, printer, new Vector3(0, 0, printer.Settings.GetValue<double>(SettingsKey.baby_step_z_offset)));
|
||||
offsetStream = new OffsetStream(maxLengthStream, printer);
|
||||
offsetStream.RuntimeOffsets[0] = new Vector3(0, 0, printer.Settings.GetValue<double>(SettingsKey.baby_step_z_offset));
|
||||
offsetStream.RuntimeOffsets[1] = new Vector3(0, 0, printer.Settings.GetValue<double>(SettingsKey.baby_step_z_offset_1));
|
||||
base.internalStream = offsetStream;
|
||||
}
|
||||
|
||||
public Vector3 Offset
|
||||
{
|
||||
get => offsetStream.Offset;
|
||||
set => offsetStream.Offset = value;
|
||||
}
|
||||
public Vector3[] RuntimeOffsets { get => offsetStream.RuntimeOffsets; }
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
|
|
@ -95,11 +97,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
return lineToSend;
|
||||
}
|
||||
|
||||
private void OffsetChanged()
|
||||
{
|
||||
offsetStream.Offset = new Vector3(0, 0, printer.Settings.GetValue<double>(SettingsKey.baby_step_z_offset));
|
||||
}
|
||||
|
||||
public void CancelMoves()
|
||||
{
|
||||
maxLengthStream.Cancel();
|
||||
|
|
|
|||
|
|
@ -42,11 +42,9 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
|
||||
Vector3[] extruderOffsets = new Vector3[4];
|
||||
|
||||
public OffsetStream(GCodeStream internalStream, PrinterConfig printer, Vector3 offset)
|
||||
public OffsetStream(GCodeStream internalStream, PrinterConfig printer)
|
||||
: base(printer, internalStream)
|
||||
{
|
||||
this.Offset = offset;
|
||||
|
||||
printer.Settings.SettingChanged += Settings_SettingChanged;
|
||||
|
||||
extruderIndex = printer.Connection.ActiveExtruderIndex;
|
||||
|
|
@ -86,15 +84,15 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
public override void SetPrinterPosition(PrinterMove position)
|
||||
{
|
||||
this.lastDestination.CopyKnowSettings(position);
|
||||
lastDestination.position -= Offset;
|
||||
if (extruderIndex < 4)
|
||||
{
|
||||
lastDestination.position -= RuntimeOffsets[extruderIndex];
|
||||
lastDestination.position += extruderOffsets[extruderIndex];
|
||||
}
|
||||
internalStream.SetPrinterPosition(lastDestination);
|
||||
}
|
||||
|
||||
public Vector3 Offset { get; set; }
|
||||
public Vector3[] RuntimeOffsets { get; private set; } = new Vector3[4];
|
||||
|
||||
public override string ReadLine()
|
||||
{
|
||||
|
|
@ -122,9 +120,9 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
PrinterMove currentMove = GetPosition(lineToSend, lastDestination);
|
||||
|
||||
PrinterMove moveToSend = currentMove;
|
||||
moveToSend.position += Offset;
|
||||
if (extruderIndex < 4)
|
||||
{
|
||||
moveToSend.position += RuntimeOffsets[extruderIndex];
|
||||
moveToSend.position -= extruderOffsets[extruderIndex];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
waitWhenCooling = false;
|
||||
lineToSend = "M104" + lineToSend.Substring(4);
|
||||
GCodeFile.GetFirstNumberAfter("S", lineToSend, ref targetTemp);
|
||||
extruderIndex = 0;
|
||||
extruderIndex = printer.Connection.ActiveExtruderIndex;
|
||||
GCodeFile.GetFirstNumberAfter("T", lineToSend, ref extruderIndex);
|
||||
if (targetTemp > ignoreRequestIfBelowTemp)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue