From 2bc3d831cd4152dc530cd0ef143778798f66c38e Mon Sep 17 00:00:00 2001 From: supermerill Date: Sat, 19 Sep 2020 19:37:28 +0200 Subject: [PATCH] Try to correct for (random?) negative printing time --- src/libslic3r/GCode.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index dba72d7c6..f3e50e2d7 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1699,6 +1699,18 @@ void GCode::_do_export(Print &print, FILE *file) if (m_silent_time_estimator_enabled) m_silent_time_estimator.scale_time(config().time_estimation_compensation.get_abs_value(1)); } + //try to compensate fora random bug #364 + if (m_normal_time_estimator.get_time() < 0) { + std::cerr << "error, negative time estimation : " << m_normal_time_estimator.get_time() << ", retry.\n"; + m_normal_time_estimator.calculate_time(true); + if (m_silent_time_estimator_enabled) + m_silent_time_estimator.calculate_time(true); + if (config().time_estimation_compensation.get_abs_value(1) != 1) { + m_normal_time_estimator.scale_time(config().time_estimation_compensation.get_abs_value(1)); + if (m_silent_time_estimator_enabled) + m_silent_time_estimator.scale_time(config().time_estimation_compensation.get_abs_value(1)); + } + } // Get filament stats. _write(file, DoExport::update_print_stats_and_format_filament_stats(