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:
Lars Brubaker 2021-09-17 11:49:16 -07:00
parent e3d7289058
commit 2eacc07781
5 changed files with 26 additions and 15 deletions

View file

@ -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 = ", ";
}
}