Skip to content

Commit

Permalink
Update ExtrusionProcessor.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
elvispr94 authored Dec 7, 2024
1 parent 3caca22 commit 4959190
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/libslic3r/GCode/ExtrusionProcessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,12 @@ class ExtrusionQualityEstimator
float final_speed;
if (distance <= speed_sections.front().first) {
final_speed = original_speed;
if (distance >0){
float t = distance / speed_sections.front().first;
t = std::clamp(t, 0.0f, 1.0f);
final_speed = (1.0f - t) * original_speed + t * speed_sections.front().second;
printf("distance %f, speed_sections.front().first %f, original speed %f, t %f, final_speed %f \n", distance, speed_sections.front().first, original_speed, final_speed);
}
} else if (distance >= speed_sections.back().first) {
final_speed = speed_sections.back().second;
} else {
Expand All @@ -438,7 +444,7 @@ class ExtrusionQualityEstimator
t = std::clamp(t, 0.0f, 1.0f);
final_speed = (1.0f - t) * speed_sections[section_idx].second + t * speed_sections[section_idx + 1].second;
}
return round(final_speed);
return final_speed;
};

float extrusion_speed = std::min(calculate_speed(curr.distance), calculate_speed(next.distance));
Expand Down

0 comments on commit 4959190

Please sign in to comment.