Fix issue that total_time is not updated after slowing down

This commit is contained in:
Noisyfox 2024-10-24 21:27:03 +08:00
parent dc943eddaf
commit 4bb6525c4f

View file

@ -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.