Move extruder offset back into baby step stream as it is always required

make sure we return the offsets for extruder 0 (needed for z offset)
Remove unused offset stream

issue:
MatterHackers/MCCentral#5150
re-slice not propogating final extruder through the stack correctly
This commit is contained in:
LarsBrubaker 2019-03-13 16:15:49 -07:00
parent d3ea4778f5
commit 64e3104d53
6 changed files with 37 additions and 219 deletions

View file

@ -41,7 +41,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
private readonly string compleatedBeforeGCodeString = "; COMPLEATED_BEFORE_GCODE";
private int activeTool;
private int extruderCount = 0;
private Vector3[] extruderOffsets = new Vector3[4];
private PrinterMove lastDestination = PrinterMove.Unknown;
private string postSwitchLine;
private double preSwitchFeedRate;
@ -57,8 +56,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
this.queuedCommandsStream = queuedCommandsStream;
extruderCount = printer.Settings.GetValue<int>(SettingsKey.extruder_count);
activeTool = printer.Connection.ActiveExtruderIndex;
printer.Settings.SettingChanged += Settings_SettingChanged;
ReadExtruderOffsets();
}
public override string DebugInfo
@ -69,13 +66,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
}
}
public override void Dispose()
{
printer.Settings.SettingChanged -= Settings_SettingChanged;
base.Dispose();
}
public override string ReadLine()
{
string lineToSend = base.ReadLine();
@ -138,21 +128,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
if (LineIsMovement(lineToSend))
{
PrinterMove currentMove = GetPosition(lineToSend, lastDestination);
PrinterMove moveToSend = currentMove;
if (activeTool < 4)
{
moveToSend.position -= extruderOffsets[activeTool];
}
if (moveToSend.HaveAnyPosition)
{
lineToSend = CreateMovementLine(moveToSend, lastDestination);
}
lastDestination = currentMove;
return lineToSend;
lastDestination = GetPosition(lineToSend, lastDestination);
}
return lineToSend;
@ -161,10 +137,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
public override void SetPrinterPosition(PrinterMove position)
{
this.lastDestination.CopyKnowSettings(position);
if (activeTool < 4)
{
lastDestination.position += extruderOffsets[activeTool];
}
internalStream.SetPrinterPosition(lastDestination);
}
@ -368,27 +340,5 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
return false;
}
private void ReadExtruderOffsets()
{
for (int i = 0; i < 4; i++)
{
extruderOffsets[i] = printer.Settings.Helpers.ExtruderOffset(i);
}
}
private void Settings_SettingChanged(object sender, StringEventArgs stringEvent)
{
if (stringEvent != null)
{
// if the offsets change update them (unless we are actively printing)
if (stringEvent.Data == SettingsKey.extruder_offset
&& !printer.Connection.Printing
&& !printer.Connection.Paused)
{
ReadExtruderOffsets();
}
}
}
}
}