diff --git a/src/libslic3r/GCode/CoolingBuffer.cpp b/src/libslic3r/GCode/CoolingBuffer.cpp index ff36ce7e21..2f4938bc7a 100644 --- a/src/libslic3r/GCode/CoolingBuffer.cpp +++ b/src/libslic3r/GCode/CoolingBuffer.cpp @@ -521,62 +521,6 @@ std::vector CoolingBuffer::parse_layer_gcode(const std:: return per_extruder_adjustments; } -// Slow down an extruder range proportionally down to slow_down_layer_time. -// Return the total time for the complete layer. -static inline float extruder_range_slow_down_proportional( - std::vector::iterator it_begin, - std::vector::iterator it_end, - // Elapsed time for the extruders already processed. - float elapsed_time_total0, - // Initial total elapsed time before slow down. - float elapsed_time_before_slowdown, - // Target time for the complete layer (all extruders applied). - float slow_down_layer_time) -{ - // Total layer time after the slow down has been applied. - float total_after_slowdown = elapsed_time_before_slowdown; - // Now decide, whether the external perimeters shall be slowed down as well. - float max_time_nep = elapsed_time_total0; - for (auto it = it_begin; it != it_end; ++ it) - max_time_nep += (*it)->maximum_time_after_slowdown(false); - if (max_time_nep > slow_down_layer_time) { - // It is sufficient to slow down the non-external perimeter moves to reach the target layer time. - // Slow down the non-external perimeters proportionally. - float non_adjustable_time = elapsed_time_total0; - for (auto it = it_begin; it != it_end; ++ it) - non_adjustable_time += (*it)->non_adjustable_time(false); - // The following step is a linear programming task due to the minimum movement speeds of the print moves. - // Run maximum 5 iterations until a good enough approximation is reached. - for (size_t iter = 0; iter < 5; ++ iter) { - float factor = (slow_down_layer_time - non_adjustable_time) / (total_after_slowdown - non_adjustable_time); - assert(factor > 1.f); - total_after_slowdown = elapsed_time_total0; - for (auto it = it_begin; it != it_end; ++ it) - total_after_slowdown += (*it)->slow_down_proportional(factor, false); - if (total_after_slowdown > 0.95f * slow_down_layer_time) - break; - } - } else { - // Slow down everything. First slow down the non-external perimeters to maximum. - for (auto it = it_begin; it != it_end; ++ it) - (*it)->slowdown_to_minimum_feedrate(false); - // Slow down the external perimeters proportionally. - float non_adjustable_time = elapsed_time_total0; - for (auto it = it_begin; it != it_end; ++ it) - non_adjustable_time += (*it)->non_adjustable_time(true); - for (size_t iter = 0; iter < 5; ++ iter) { - float factor = (slow_down_layer_time - non_adjustable_time) / (total_after_slowdown - non_adjustable_time); - assert(factor > 1.f); - total_after_slowdown = elapsed_time_total0; - for (auto it = it_begin; it != it_end; ++ it) - total_after_slowdown += (*it)->slow_down_proportional(factor, true); - if (total_after_slowdown > 0.95f * slow_down_layer_time) - break; - } - } - return total_after_slowdown; -} - // Slow down an extruder range to slow_down_layer_time. // Return the total time for the complete layer. static inline void extruder_range_slow_down_non_proportional( @@ -674,9 +618,8 @@ float CoolingBuffer::calculate_layer_slowdown(std::vector 0) { by_slowdown_time.emplace_back(&adj); - if (! m_cooling_logic_proportional) - // sorts the lines, also sets adj.time_non_adjustable - adj.sort_lines_by_decreasing_feedrate(); + // sorts the lines, also sets adj.time_non_adjustable + adj.sort_lines_by_decreasing_feedrate(); } else elapsed_time_total0 += adj.elapsed_time_total(); } @@ -700,10 +643,7 @@ float CoolingBuffer::calculate_layer_slowdown(std::vectortime_maximum; if (max_time > slow_down_layer_time) { - if (m_cooling_logic_proportional) - extruder_range_slow_down_proportional(cur_begin, by_slowdown_time.end(), elapsed_time_total0, total, slow_down_layer_time); - else - extruder_range_slow_down_non_proportional(cur_begin, by_slowdown_time.end(), slow_down_layer_time - total); + extruder_range_slow_down_non_proportional(cur_begin, by_slowdown_time.end(), slow_down_layer_time - total); } else { // Slow down to maximum possible. for (auto it = cur_begin; it != by_slowdown_time.end(); ++ it) diff --git a/src/libslic3r/GCode/CoolingBuffer.hpp b/src/libslic3r/GCode/CoolingBuffer.hpp index 7fb55985f7..dcbf0120b8 100644 --- a/src/libslic3r/GCode/CoolingBuffer.hpp +++ b/src/libslic3r/GCode/CoolingBuffer.hpp @@ -54,9 +54,6 @@ private: // the PrintConfig slice of FullPrintConfig is constant, thus no thread synchronization is required. const PrintConfig &m_config; unsigned int m_current_extruder; - - // Old logic: proportional. - bool m_cooling_logic_proportional = false; //BBS: current fan speed int m_current_fan_speed; };