Going back to the old leveling method.
This commit is contained in:
parent
387f4297bc
commit
47968f566f
13 changed files with 46 additions and 150 deletions
|
|
@ -112,25 +112,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
return currentDestination;
|
||||
}
|
||||
|
||||
public static bool LineIsZHoming(string lineBeingSent)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(lineBeingSent))
|
||||
{
|
||||
if(lineBeingSent.Contains(";"))
|
||||
{
|
||||
lineBeingSent = lineBeingSent.Split(';')[0];
|
||||
}
|
||||
bool isAZHome = lineBeingSent.StartsWith("G28") && lineBeingSent.Contains("Z");
|
||||
bool isANakedHome = lineBeingSent.Trim() == "G28";
|
||||
if (isAZHome || isANakedHome)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool LineIsMovement(string lineBeingSent)
|
||||
{
|
||||
if (lineBeingSent.StartsWith("G0 ")
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
public class PrintLevelingStream : GCodeStreamProxy
|
||||
{
|
||||
bool activePrinting;
|
||||
bool hadZHome = false;
|
||||
protected PrinterMove lastDestination = new PrinterMove();
|
||||
public PrintLevelingStream(GCodeStream internalStream, bool activePrinting)
|
||||
: base(internalStream)
|
||||
|
|
@ -52,30 +51,8 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
public PrinterMove LastDestination { get { return lastDestination; } }
|
||||
public override string ReadLine()
|
||||
{
|
||||
if (hadZHome)
|
||||
{
|
||||
hadZHome = false;
|
||||
// only add this when exporting to gcode
|
||||
if (!activePrinting)
|
||||
{
|
||||
// return the correct G92
|
||||
double zOffset = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.z_offset_after_home);
|
||||
if (zOffset != 0)
|
||||
{
|
||||
double newHomePosition = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.printer_z_after_home) + zOffset;
|
||||
return $"G92 Z{newHomePosition}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string lineFromChild = base.ReadLine();
|
||||
|
||||
if (lineFromChild != null
|
||||
&& LineIsZHoming(lineFromChild))
|
||||
{
|
||||
hadZHome = true;
|
||||
}
|
||||
|
||||
if (lineFromChild != null
|
||||
&& PrinterConnectionAndCommunication.Instance.ActivePrinter.GetValue<bool>(SettingsKey.print_leveling_enabled))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1836,29 +1836,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|
||||
waitingForPosition.Stop();
|
||||
waitingForPosition.Reset();
|
||||
|
||||
if(storePositionToPrinterZAfterHome)
|
||||
{
|
||||
storePositionToPrinterZAfterHome = false;
|
||||
double storedHomePosition = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.printer_z_after_home);
|
||||
// if printer_z_after_home != current z position
|
||||
if (storedHomePosition != LastReportedPosition.z)
|
||||
{
|
||||
ActiveSliceSettings.Instance.SetValue(SettingsKey.printer_z_after_home, LastReportedPosition.z.ToString());
|
||||
ApplicationController.Instance.ReloadAdvancedControlsPanel();
|
||||
}
|
||||
|
||||
if (ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.print_leveling_enabled))
|
||||
{
|
||||
// now send a G92 to set the position that we want to think is home
|
||||
double zOffset = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.z_offset_after_home);
|
||||
if (zOffset != 0)
|
||||
{
|
||||
double newHomePosition = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.printer_z_after_home) + zOffset;
|
||||
SendLineToPrinterNow($"G92 Z{newHomePosition}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ReadTemperatures(object sender, EventArgs e)
|
||||
|
|
@ -2938,11 +2915,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|| (lineWithoutChecksum.StartsWith("T") && !lineWithoutChecksum.StartsWith("T:"))) // is a switch extruder (verify this is the right time to ask this)
|
||||
{
|
||||
SendLineToPrinterNow("M114");
|
||||
|
||||
if (GCodeStream.LineIsZHoming(lineWithoutChecksum))
|
||||
{
|
||||
storePositionToPrinterZAfterHome = true;
|
||||
}
|
||||
}
|
||||
|
||||
// write data to communication
|
||||
|
|
@ -3020,7 +2992,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
}
|
||||
|
||||
bool haveHookedDrawing = false;
|
||||
private bool storePositionToPrinterZAfterHome = false;
|
||||
|
||||
public class ReadThread
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue