mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
FIX: backend get the extruder id based on filament_map
Change-Id: Ib7679c0fc67336e462467dab9f5b4d4684d6eb19 (cherry picked from commit dcd9fd501354da33baea2adc0f645fabe8880cf1)
This commit is contained in:
@@ -78,7 +78,7 @@ struct CoolingLine
|
||||
length(0.f), feedrate(0.f), time(0.f), time_max(0.f), slowdown(false) {}
|
||||
|
||||
bool adjustable(bool slowdown_external_perimeters) const {
|
||||
return (this->type & TYPE_ADJUSTABLE) &&
|
||||
return (this->type & TYPE_ADJUSTABLE) &&
|
||||
(! (this->type & TYPE_EXTERNAL_PERIMETER) || slowdown_external_perimeters) &&
|
||||
this->time < this->time_max;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ struct CoolingLine
|
||||
};
|
||||
|
||||
// Calculate the required per extruder time stretches.
|
||||
struct PerExtruderAdjustments
|
||||
struct PerExtruderAdjustments
|
||||
{
|
||||
// Calculate the total elapsed time per this extruder, adjusted for the slowdown.
|
||||
float elapsed_time_total() const {
|
||||
@@ -114,7 +114,7 @@ struct PerExtruderAdjustments
|
||||
time_total += line.time;
|
||||
return time_total;
|
||||
}
|
||||
// Calculate the total elapsed time when slowing down
|
||||
// Calculate the total elapsed time when slowing down
|
||||
// to the minimum extrusion feed rate defined for the current material.
|
||||
float maximum_time_after_slowdown(bool slowdown_external_perimeters) const {
|
||||
float time_total = 0.f;
|
||||
@@ -185,7 +185,7 @@ struct PerExtruderAdjustments
|
||||
bool adj2 = l2.adjustable();
|
||||
return (adj1 == adj2) ? l1.feedrate > l2.feedrate : adj1;
|
||||
});
|
||||
for (n_lines_adjustable = 0;
|
||||
for (n_lines_adjustable = 0;
|
||||
n_lines_adjustable < lines.size() && this->lines[n_lines_adjustable].adjustable();
|
||||
++ n_lines_adjustable);
|
||||
time_non_adjustable = 0.f;
|
||||
@@ -242,7 +242,7 @@ struct PerExtruderAdjustments
|
||||
// The following two values are set by sort_lines_by_decreasing_feedrate():
|
||||
// Number of adjustable lines, at the start of lines.
|
||||
size_t n_lines_adjustable = 0;
|
||||
// Non-adjustable time of lines starting with n_lines_adjustable.
|
||||
// Non-adjustable time of lines starting with n_lines_adjustable.
|
||||
float time_non_adjustable = 0;
|
||||
// Current total time for this extruder.
|
||||
float time_total = 0;
|
||||
@@ -257,7 +257,7 @@ struct PerExtruderAdjustments
|
||||
// Calculate a new feedrate when slowing down by time_stretch for segments faster than min_feedrate.
|
||||
// Used by non-proportional slow down.
|
||||
float new_feedrate_to_reach_time_stretch(
|
||||
std::vector<PerExtruderAdjustments*>::const_iterator it_begin, std::vector<PerExtruderAdjustments*>::const_iterator it_end,
|
||||
std::vector<PerExtruderAdjustments*>::const_iterator it_begin, std::vector<PerExtruderAdjustments*>::const_iterator it_end,
|
||||
float min_feedrate, float time_stretch, size_t max_iter = 20)
|
||||
{
|
||||
float new_feedrate = min_feedrate;
|
||||
@@ -285,7 +285,7 @@ float new_feedrate_to_reach_time_stretch(
|
||||
for (size_t i = 0; i < (*it)->n_lines_adjustable; ++i) {
|
||||
const CoolingLine &line = (*it)->lines[i];
|
||||
if (line.feedrate > min_feedrate && line.feedrate < new_feedrate)
|
||||
// Some of the line segments taken into account in the calculation of nomin / denom are now slower than new_feedrate,
|
||||
// Some of the line segments taken into account in the calculation of nomin / denom are now slower than new_feedrate,
|
||||
// which makes the new_feedrate lower than it should be.
|
||||
// Re-run the calculation with a new min_feedrate limit, so that the segments with current feedrate lower than new_feedrate
|
||||
// are not taken into account.
|
||||
@@ -361,7 +361,7 @@ std::vector<PerExtruderAdjustments> CoolingBuffer::parse_layer_gcode(const std::
|
||||
// Time of any other movements before the first extrusion will be excluded from the layer time.
|
||||
bool layer_had_extrusion = false;
|
||||
|
||||
for (; *line_start != 0; line_start = line_end)
|
||||
for (; *line_start != 0; line_start = line_end)
|
||||
{
|
||||
while (*line_end != '\n' && *line_end != 0)
|
||||
++ line_end;
|
||||
@@ -574,7 +574,7 @@ static inline void extruder_range_slow_down_non_proportional(
|
||||
}
|
||||
assert(feedrate > 0.f);
|
||||
// Sort by slow_down_min_speed, maximum speed first.
|
||||
std::sort(by_min_print_speed.begin(), by_min_print_speed.end(),
|
||||
std::sort(by_min_print_speed.begin(), by_min_print_speed.end(),
|
||||
[](const PerExtruderAdjustments *p1, const PerExtruderAdjustments *p2){ return p1->slow_down_min_speed > p2->slow_down_min_speed; });
|
||||
// Slow down, fast moves first.
|
||||
for (;;) {
|
||||
@@ -696,7 +696,7 @@ std::string CoolingBuffer::apply_layer_cooldown(
|
||||
// Source G-code for the current layer.
|
||||
const std::string &gcode,
|
||||
// ID of the current layer, used to disable fan for the first n layers.
|
||||
size_t layer_id,
|
||||
size_t layer_id,
|
||||
// Total time of this layer after slow down, used to control the fan.
|
||||
float layer_time,
|
||||
// Per extruder list of G-code lines and their cool down attributes.
|
||||
|
||||
Reference in New Issue
Block a user