GCodeTimeEstimator - Fixed _simulate_st_synchronize()

This commit is contained in:
Enrico Turri 2018-01-08 13:23:54 +01:00
parent aeca5def00
commit e94491ee8c
2 changed files with 14 additions and 3 deletions

View File

@ -153,6 +153,9 @@ namespace Slic3r {
[this](GCodeReader &reader, const GCodeReader::GCodeLine &line) [this](GCodeReader &reader, const GCodeReader::GCodeLine &line)
{ this->_process_gcode_line(reader, line); }); { this->_process_gcode_line(reader, line); });
_calculate_time();
_reset_blocks();
_reset(); _reset();
} }
@ -163,6 +166,7 @@ namespace Slic3r {
_parser.parse_file(file, boost::bind(&GCodeTimeEstimator::_process_gcode_line, this, _1, _2)); _parser.parse_file(file, boost::bind(&GCodeTimeEstimator::_process_gcode_line, this, _1, _2));
_calculate_time(); _calculate_time();
_reset_blocks();
_reset(); _reset();
} }
@ -176,6 +180,7 @@ namespace Slic3r {
_parser.parse_line(line, action); _parser.parse_line(line, action);
_calculate_time(); _calculate_time();
_reset_blocks();
_reset(); _reset();
} }
@ -203,6 +208,7 @@ namespace Slic3r {
{ {
PROFILE_FUNC(); PROFILE_FUNC();
_calculate_time(); _calculate_time();
_reset_blocks();
_reset(); _reset();
} }
@ -387,6 +393,7 @@ namespace Slic3r {
void GCodeTimeEstimator::reset() void GCodeTimeEstimator::reset()
{ {
_time = 0.0f; _time = 0.0f;
_reset_blocks();
_reset(); _reset();
} }
@ -416,8 +423,6 @@ namespace Slic3r {
void GCodeTimeEstimator::_reset() void GCodeTimeEstimator::_reset()
{ {
_blocks.clear();
_curr.reset(); _curr.reset();
_prev.reset(); _prev.reset();
@ -428,6 +433,11 @@ namespace Slic3r {
set_additional_time(0.0f); set_additional_time(0.0f);
} }
void GCodeTimeEstimator::_reset_blocks()
{
_blocks.clear();
}
void GCodeTimeEstimator::_calculate_time() void GCodeTimeEstimator::_calculate_time()
{ {
_forward_pass(); _forward_pass();
@ -954,7 +964,7 @@ namespace Slic3r {
void GCodeTimeEstimator::_simulate_st_synchronize() void GCodeTimeEstimator::_simulate_st_synchronize()
{ {
_calculate_time(); _calculate_time();
_reset(); _reset_blocks();
} }
void GCodeTimeEstimator::_forward_pass() void GCodeTimeEstimator::_forward_pass()

View File

@ -246,6 +246,7 @@ namespace Slic3r {
private: private:
void _reset(); void _reset();
void _reset_blocks();
// Calculates the time estimate // Calculates the time estimate
void _calculate_time(); void _calculate_time();