Fixed an issue with the fan speed no displaying correctly in the gcode preview
Fixed an issue with writing '; Software Leveling Applied' more than once into gocde files if double exported. The gcode file was output correctly before but had multiple lines describing '; Software Leveling Applied'
This commit is contained in:
parent
e3d7289058
commit
2eacc07781
5 changed files with 26 additions and 15 deletions
|
|
@ -232,9 +232,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
else if (line.StartsWith("M106")) // fan on
|
||||
{
|
||||
double speed = 0;
|
||||
if (GCodeFile.GetFirstNumberAfter("M106", line, ref speed, 0, ""))
|
||||
if (GCodeFile.GetFirstNumberAfter("S", line, ref speed, 0, ""))
|
||||
{
|
||||
fanSpeeds += separator + $"{speed / 255 * 100:0}%";
|
||||
fanSpeeds += separator + $"{speed * 100 / 255:0}%";
|
||||
separator = ", ";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using MatterControl.Printing;
|
||||
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.VectorMath;
|
||||
|
|
@ -55,6 +56,8 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
}
|
||||
}
|
||||
|
||||
private GCodeFile loadedGCode;
|
||||
|
||||
public bool AllowLeveling { get; set; }
|
||||
|
||||
private PrinterMove inputUnleveled = PrinterMove.Unknown;
|
||||
|
|
@ -69,15 +72,28 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
}
|
||||
}
|
||||
|
||||
public static string SoftwareLevelingAppliedMessage => "; Software Leveling Applied";
|
||||
|
||||
public override string ReadLine()
|
||||
{
|
||||
if (!wroteLevelingStatus && LevelingActive)
|
||||
string lineToSend = base.ReadLine();
|
||||
|
||||
if (lineToSend == SoftwareLevelingAppliedMessage)
|
||||
{
|
||||
wroteLevelingStatus = true;
|
||||
return "; Software Leveling Applied";
|
||||
gcodeAlreadyLeveled = true;
|
||||
}
|
||||
|
||||
string lineToSend = base.ReadLine();
|
||||
if (!gcodeAlreadyLeveled
|
||||
&& !wroteLevelingStatus
|
||||
&& LevelingActive)
|
||||
{
|
||||
// make sure we are not reading a gcode file that already has leveling applied
|
||||
if (loadedGCode?.Instruction(0)?.Line != SoftwareLevelingAppliedMessage)
|
||||
{
|
||||
wroteLevelingStatus = true;
|
||||
return SoftwareLevelingAppliedMessage;
|
||||
}
|
||||
}
|
||||
|
||||
if (lineToSend != null
|
||||
&& lineToSend.EndsWith("; NO_PROCESSING"))
|
||||
|
|
@ -85,11 +101,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
return lineToSend;
|
||||
}
|
||||
|
||||
if (lineToSend == "; Software Leveling Applied")
|
||||
{
|
||||
gcodeAlreadyLeveled = true;
|
||||
}
|
||||
|
||||
if (lineToSend != null
|
||||
&& LevelingActive
|
||||
&& !gcodeAlreadyLeveled)
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
return lineToSend;
|
||||
}
|
||||
|
||||
if (lineToSend == "; Software Leveling Applied")
|
||||
if (lineToSend == PrintLevelingStream.SoftwareLevelingAppliedMessage)
|
||||
{
|
||||
gcodeAlreadyLeveled = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue