fix an issue that pressure eq may cause 0 feedrate in vase mode (#4398)

fix an issue that pressure eq may cause 0 feedrate
This commit is contained in:
SoftFever 2024-03-10 09:30:13 +08:00 committed by GitHub
parent 89f51031eb
commit 849fe44bf9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 18 deletions

View file

@ -132,7 +132,8 @@ private:
float time() const { return dist_xyz() / feedrate(); }
float time_inv() const { return feedrate() / dist_xyz(); }
float volumetric_correction_avg() const {
float avg_correction = 0.5f * (volumetric_extrusion_rate_start + volumetric_extrusion_rate_end) / volumetric_extrusion_rate;
// Orca: cap the correction to 0.05 - 1.00000001 to avoid zero feedrate
float avg_correction = std::max(0.05f,0.5f * (volumetric_extrusion_rate_start + volumetric_extrusion_rate_end) / volumetric_extrusion_rate);
assert(avg_correction > 0.f);
assert(avg_correction <= 1.00000001f);
return avg_correction;