Export the first M73 line to gcode before custom gcode

This commit is contained in:
Enrico Turri 2018-09-07 16:05:10 +02:00
parent 00c51e06ed
commit 62894d3f7b
3 changed files with 23 additions and 2 deletions

View file

@ -168,6 +168,9 @@ namespace Slic3r {
}
#endif // ENABLE_MOVE_STATS
const std::string GCodeTimeEstimator::Normal_First_M73_Output_Placeholder_Tag = "; NORMAL_FIRST_M73_OUTPUT_PLACEHOLDER";
const std::string GCodeTimeEstimator::Silent_First_M73_Output_Placeholder_Tag = "; SILENT_FIRST_M73_OUTPUT_PLACEHOLDER";
GCodeTimeEstimator::GCodeTimeEstimator(EMode mode)
: _mode(mode)
{
@ -294,7 +297,15 @@ namespace Slic3r {
throw std::runtime_error(std::string("Remaining times export failed.\nError while reading from file.\n"));
}
gcode_line += "\n";
// replaces placeholders for initial line M73 with the real lines
if (((_mode == Normal) && (gcode_line == Normal_First_M73_Output_Placeholder_Tag)) ||
((_mode == Silent) && (gcode_line == Silent_First_M73_Output_Placeholder_Tag)))
{
sprintf(time_line, time_mask.c_str(), std::to_string(0), _get_time_minutes(_time).c_str());
gcode_line = time_line;
}
else
gcode_line += "\n";
// add remaining time lines where needed
_parser.parse_line(gcode_line,