Make sure we put the leveling steam in after the max length stream
Fixes bug with leveling long lines
This commit is contained in:
parent
4d3ab1a16f
commit
b0d84a0a36
6 changed files with 57 additions and 30 deletions
|
|
@ -2765,6 +2765,7 @@ To Create:
|
|||
ShowAsOverride = false,
|
||||
Show = (settings) => !settings.GetBool(SettingsKey.enable_network_printing),
|
||||
RequiredDisplayDetail = DisplayDetailRequired.Simple,
|
||||
UiUpdate = UiUpdateRequired.SliceSettings,
|
||||
DefaultValue = "",
|
||||
RebuildGCodeOnChange = false
|
||||
},
|
||||
|
|
|
|||
|
|
@ -307,8 +307,6 @@ namespace MatterHackers.MatterControl.Library.Export
|
|||
|
||||
bool levelingEnabled = printer.Settings.GetValue<bool>(SettingsKey.print_leveling_enabled) && applyLeveling;
|
||||
|
||||
accumulatedStream = new BabyStepsStream(printer, accumulatedStream);
|
||||
|
||||
if (levelingEnabled
|
||||
&& printer.Settings.GetValue<bool>(SettingsKey.enable_line_splitting))
|
||||
{
|
||||
|
|
@ -319,17 +317,19 @@ namespace MatterHackers.MatterControl.Library.Export
|
|||
accumulatedStream = new MaxLengthStream(printer, accumulatedStream, 1000);
|
||||
}
|
||||
|
||||
if (printer.Settings.GetValue<bool>(SettingsKey.emulate_endstops))
|
||||
{
|
||||
var softwareEndstopsExStream12 = new SoftwareEndstopsStream(printer, accumulatedStream);
|
||||
accumulatedStream = softwareEndstopsExStream12;
|
||||
}
|
||||
|
||||
if (levelingEnabled
|
||||
&& !LevelingPlan.NeedsToBeRun(printer))
|
||||
{
|
||||
accumulatedStream = new PrintLevelingStream(printer, accumulatedStream);
|
||||
}
|
||||
|
||||
if (printer.Settings.GetValue<bool>(SettingsKey.emulate_endstops))
|
||||
{
|
||||
var softwareEndstopsExStream12 = new SoftwareEndstopsStream(printer, accumulatedStream);
|
||||
accumulatedStream = softwareEndstopsExStream12;
|
||||
}
|
||||
accumulatedStream = new BabyStepsStream(printer, accumulatedStream);
|
||||
|
||||
accumulatedStream = new RemoveNOPsStream(printer, accumulatedStream);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,21 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
public MaxLengthStream(PrinterConfig printer, GCodeStream internalStream, double maxSegmentLength)
|
||||
: base(printer, internalStream)
|
||||
{
|
||||
// make sure there is no BabyStepStream already (it must come after max length)
|
||||
#if DEBUG
|
||||
foreach(var subStream in this.InternalStreams())
|
||||
{
|
||||
if (subStream is BabyStepsStream)
|
||||
{
|
||||
throw new Exception("MaxLengthStream must come before BabyStepsSteam (we need the max length points to be baby stepped).");
|
||||
}
|
||||
|
||||
if (subStream is PrintLevelingStream)
|
||||
{
|
||||
throw new Exception("MaxLengthStream must come before PrintLevelingStream (we need the max length points to be leveled).");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
this.MaxSegmentLength = maxSegmentLength;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ using MatterControl.Printing;
|
|||
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.VectorMath;
|
||||
using System;
|
||||
|
||||
namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
||||
{
|
||||
|
|
@ -44,6 +45,16 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
public PrintLevelingStream(PrinterConfig printer, GCodeStream internalStream)
|
||||
: base(printer, internalStream)
|
||||
{
|
||||
#if DEBUG
|
||||
foreach (var subStream in this.InternalStreams())
|
||||
{
|
||||
if (subStream is BabyStepsStream)
|
||||
{
|
||||
throw new Exception("PrintLevelingStream must come before BabyStepsSteam (we need the max length points to be baby stepped).");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// always reset this when we construct
|
||||
AllowLeveling = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2464,6 +2464,9 @@ Make sure that your printer is turned on. Some printers will appear to be connec
|
|||
accumulatedStream = new ToolSpeedMultiplierStream(Printer, accumulatedStream);
|
||||
}
|
||||
|
||||
bool enableLineSplitting = gcodeStream != null && Printer.Settings.GetValue<bool>(SettingsKey.enable_line_splitting);
|
||||
accumulatedStream = maxLengthStream = new MaxLengthStream(Printer, accumulatedStream, enableLineSplitting ? 1 : 2000);
|
||||
|
||||
var doValidateLeveling = Printer.Settings.Helpers.ValidateLevelingWithProbe;
|
||||
if (!LevelingPlan.NeedsToBeRun(Printer)
|
||||
|| doValidateLeveling)
|
||||
|
|
@ -2480,9 +2483,6 @@ Make sure that your printer is turned on. Some printers will appear to be connec
|
|||
|
||||
accumulatedStream = new BabyStepsStream(Printer, accumulatedStream);
|
||||
|
||||
bool enableLineSplitting = gcodeStream != null && Printer.Settings.GetValue<bool>(SettingsKey.enable_line_splitting);
|
||||
accumulatedStream = maxLengthStream = new MaxLengthStream(Printer, accumulatedStream, enableLineSplitting ? 1 : 2000);
|
||||
|
||||
accumulatedStream = waitForTempStream = new WaitForTempStream(Printer, accumulatedStream);
|
||||
accumulatedStream = ExtrusionMultiplierStream = new ExtrusionMultiplierStream(Printer, accumulatedStream);
|
||||
accumulatedStream = FeedRateMultiplierStream = new FeedRateMultiplierStream(Printer, accumulatedStream);
|
||||
|
|
|
|||
|
|
@ -201,16 +201,16 @@ namespace MatterControl.Tests.MatterControl
|
|||
PrintLevelingStream.SoftwareLevelingAppliedMessage,
|
||||
"G1 X0 Y0 Z-0.1 E0 F1000",
|
||||
"G1 E1",
|
||||
"G1 X1 Y0 Z-0.1",
|
||||
"G1 X2 Y0 Z-0.1",
|
||||
"G1 X3 Y0 Z-0.1",
|
||||
"G1 X4 Y0 Z-0.1",
|
||||
"G1 X5 Y0 Z-0.1",
|
||||
"G1 X6 Y0 Z-0.1",
|
||||
"G1 X7 Y0 Z-0.1",
|
||||
"G1 X8 Y0 Z-0.1",
|
||||
"G1 X9 Y0 Z-0.1",
|
||||
"G1 X10 Y0 Z-0.1",
|
||||
"G1 X1",
|
||||
"G1 X2",
|
||||
"G1 X3",
|
||||
"G1 X4",
|
||||
"G1 X5",
|
||||
"G1 X6",
|
||||
"G1 X7",
|
||||
"G1 X8",
|
||||
"G1 X9",
|
||||
"G1 X10",
|
||||
};
|
||||
|
||||
var printer = new PrinterConfig(new PrinterSettings());
|
||||
|
|
@ -250,16 +250,16 @@ namespace MatterControl.Tests.MatterControl
|
|||
PrintLevelingStream.SoftwareLevelingAppliedMessage,
|
||||
"G1 X0 Y0 Z-0.1 E0 F1000",
|
||||
"G1 E1",
|
||||
"G1 X1 Y0 Z-0.1",
|
||||
"G1 X2 Y0 Z-0.1",
|
||||
"G1 X3 Y0 Z-0.1",
|
||||
"G1 X4 Y0 Z-0.1",
|
||||
"G1 X5 Y0 Z-0.1",
|
||||
"G1 X6 Y0 Z-0.1",
|
||||
"G1 X7 Y0 Z-0.1",
|
||||
"G1 X8 Y0 Z-0.1",
|
||||
"G1 X9 Y0 Z-0.1",
|
||||
"G1 X10 Y0 Z-0.1",
|
||||
"G1 X1",
|
||||
"G1 X2",
|
||||
"G1 X3",
|
||||
"G1 X4",
|
||||
"G1 X5",
|
||||
"G1 X6",
|
||||
"G1 X7",
|
||||
"G1 X8",
|
||||
"G1 X9",
|
||||
"G1 X10",
|
||||
};
|
||||
|
||||
var printer = new PrinterConfig(new PrinterSettings());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue