mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-20 01:11:07 +08:00
Merge branch 'main' into dev/arachen-sync
This commit is contained in:
commit
cbc04e944c
@ -151,6 +151,7 @@ struct PerExtruderAdjustments
|
|||||||
}
|
}
|
||||||
time_total += line.time;
|
time_total += line.time;
|
||||||
}
|
}
|
||||||
|
this->time_total = time_total;
|
||||||
return time_total;
|
return time_total;
|
||||||
}
|
}
|
||||||
// Slow down each adjustable G-code line proportionally by a factor.
|
// Slow down each adjustable G-code line proportionally by a factor.
|
||||||
@ -166,6 +167,7 @@ struct PerExtruderAdjustments
|
|||||||
}
|
}
|
||||||
time_total += line.time;
|
time_total += line.time;
|
||||||
}
|
}
|
||||||
|
this->time_total = time_total;
|
||||||
return time_total;
|
return time_total;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,6 +206,7 @@ struct PerExtruderAdjustments
|
|||||||
// Used by non-proportional slow down.
|
// Used by non-proportional slow down.
|
||||||
void slow_down_to_feedrate(float min_feedrate) {
|
void slow_down_to_feedrate(float min_feedrate) {
|
||||||
assert(this->slow_down_min_speed < min_feedrate + EPSILON);
|
assert(this->slow_down_min_speed < min_feedrate + EPSILON);
|
||||||
|
float time_total = 0.f;
|
||||||
for (size_t i = 0; i < n_lines_adjustable; ++ i) {
|
for (size_t i = 0; i < n_lines_adjustable; ++ i) {
|
||||||
CoolingLine &line = lines[i];
|
CoolingLine &line = lines[i];
|
||||||
if (line.feedrate > min_feedrate) {
|
if (line.feedrate > min_feedrate) {
|
||||||
@ -211,7 +214,9 @@ struct PerExtruderAdjustments
|
|||||||
line.feedrate = min_feedrate;
|
line.feedrate = min_feedrate;
|
||||||
line.slowdown = true;
|
line.slowdown = true;
|
||||||
}
|
}
|
||||||
|
time_total += line.time;
|
||||||
}
|
}
|
||||||
|
this->time_total = time_total;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extruder, for which the G-code will be adjusted.
|
// Extruder, for which the G-code will be adjusted.
|
||||||
@ -346,6 +351,10 @@ std::vector<PerExtruderAdjustments> CoolingBuffer::parse_layer_gcode(const std::
|
|||||||
// for a sequence of extrusion moves.
|
// for a sequence of extrusion moves.
|
||||||
size_t active_speed_modifier = size_t(-1);
|
size_t active_speed_modifier = size_t(-1);
|
||||||
|
|
||||||
|
// Orca: Whether we had our first extrusion in this layer.
|
||||||
|
// 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)
|
while (*line_end != '\n' && *line_end != 0)
|
||||||
@ -405,6 +414,10 @@ std::vector<PerExtruderAdjustments> CoolingBuffer::parse_layer_gcode(const std::
|
|||||||
if (wipe)
|
if (wipe)
|
||||||
line.type |= CoolingLine::TYPE_WIPE;
|
line.type |= CoolingLine::TYPE_WIPE;
|
||||||
|
|
||||||
|
// Orca: only slow down movements since the first extrusion
|
||||||
|
if (boost::contains(sline, ";_EXTRUDE_SET_SPEED"))
|
||||||
|
layer_had_extrusion = true;
|
||||||
|
|
||||||
// ORCA: Dont slowdown external perimeters for layer time feature
|
// ORCA: Dont slowdown external perimeters for layer time feature
|
||||||
// use the adjustment pointer to ensure the value for the current extruder (filament) is used.
|
// use the adjustment pointer to ensure the value for the current extruder (filament) is used.
|
||||||
bool adjust_external = true;
|
bool adjust_external = true;
|
||||||
@ -514,6 +527,13 @@ std::vector<PerExtruderAdjustments> CoolingBuffer::parse_layer_gcode(const std::
|
|||||||
} else if (boost::starts_with(sline, ";_FORCE_RESUME_FAN_SPEED")) {
|
} else if (boost::starts_with(sline, ";_FORCE_RESUME_FAN_SPEED")) {
|
||||||
line.type = CoolingLine::TYPE_FORCE_RESUME_FAN;
|
line.type = CoolingLine::TYPE_FORCE_RESUME_FAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Orca: For any movements before this layer's first ever extrusion, we exclude them from the layer time calculation.
|
||||||
|
if (!layer_had_extrusion) {
|
||||||
|
assert((line.type & CoolingLine::TYPE_ADJUSTABLE) == 0);
|
||||||
|
line.time = line.time_max = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (line.type != 0)
|
if (line.type != 0)
|
||||||
adjustment->lines.emplace_back(std::move(line));
|
adjustment->lines.emplace_back(std::move(line));
|
||||||
}
|
}
|
||||||
@ -535,8 +555,7 @@ static inline void extruder_range_slow_down_non_proportional(
|
|||||||
for (PerExtruderAdjustments *adj : by_min_print_speed) {
|
for (PerExtruderAdjustments *adj : by_min_print_speed) {
|
||||||
adj->idx_line_begin = 0;
|
adj->idx_line_begin = 0;
|
||||||
adj->idx_line_end = 0;
|
adj->idx_line_end = 0;
|
||||||
assert(adj->idx_line_begin < adj->n_lines_adjustable);
|
if (adj->idx_line_begin < adj->n_lines_adjustable && adj->lines[adj->idx_line_begin].feedrate> feedrate)
|
||||||
if (adj->lines[adj->idx_line_begin].feedrate > feedrate)
|
|
||||||
feedrate = adj->lines[adj->idx_line_begin].feedrate;
|
feedrate = adj->lines[adj->idx_line_begin].feedrate;
|
||||||
}
|
}
|
||||||
assert(feedrate > 0.f);
|
assert(feedrate > 0.f);
|
||||||
@ -623,6 +642,7 @@ float CoolingBuffer::calculate_layer_slowdown(std::vector<PerExtruderAdjustments
|
|||||||
} else
|
} else
|
||||||
elapsed_time_total0 += adj.elapsed_time_total();
|
elapsed_time_total0 += adj.elapsed_time_total();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort(by_slowdown_time.begin(), by_slowdown_time.end(),
|
std::sort(by_slowdown_time.begin(), by_slowdown_time.end(),
|
||||||
[](const PerExtruderAdjustments *adj1, const PerExtruderAdjustments *adj2)
|
[](const PerExtruderAdjustments *adj1, const PerExtruderAdjustments *adj2)
|
||||||
{ return adj1->slow_down_layer_time < adj2->slow_down_layer_time; });
|
{ return adj1->slow_down_layer_time < adj2->slow_down_layer_time; });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user