Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ExtrusionProcessor.hpp #7689

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update ExtrusionProcessor.hpp
elvispr94 authored Dec 7, 2024
commit 95a9fdea07ea91192b4b45ea94b130156696a2b0
9 changes: 7 additions & 2 deletions src/libslic3r/GCode/ExtrusionProcessor.hpp
Original file line number Diff line number Diff line change
@@ -421,11 +421,16 @@ class ExtrusionQualityEstimator
}
}
}

auto calculate_speed = [&speed_sections, &original_speed](float distance) {
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 {
@@ -438,7 +443,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));