mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-05 20:46:07 +08:00
Remove unused slow down proportionally code (#6405)
* Remove unused slow down proportionally code
This commit is contained in:
parent
a7d2ae0450
commit
0c63dd4bd0
@ -521,62 +521,6 @@ std::vector<PerExtruderAdjustments> 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<PerExtruderAdjustments*>::iterator it_begin,
|
||||
std::vector<PerExtruderAdjustments*>::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,7 +618,6 @@ float CoolingBuffer::calculate_layer_slowdown(std::vector<PerExtruderAdjustments
|
||||
adj.time_maximum = adj.maximum_time_after_slowdown(true);
|
||||
if (adj.cooling_slow_down_enabled && adj.lines.size() > 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();
|
||||
} else
|
||||
@ -700,9 +643,6 @@ float CoolingBuffer::calculate_layer_slowdown(std::vector<PerExtruderAdjustments
|
||||
for (auto it = cur_begin; it != by_slowdown_time.end(); ++ it)
|
||||
max_time += (*it)->time_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);
|
||||
} else {
|
||||
// Slow down to maximum possible.
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user