mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 20:45:54 +08:00
SPE-2193: Fix zero velocity when the pressure equalizer is combined with spiral vase mode.
Co-authored-by: Noisyfox <timemanager.rick@gmail.com> Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
parent
7594ba338a
commit
b4fadc102d
@ -642,7 +642,7 @@ void PressureEqualizer::adjust_volumetric_rate(const size_t first_line_idx, cons
|
||||
}
|
||||
|
||||
if (line.adjustable_flow) {
|
||||
float rate_start = rate_end + rate_slope * line.time_corrected();
|
||||
float rate_start = sqrt(rate_end * rate_end + 2 * line.volumetric_extrusion_rate * line.dist_xyz() * rate_slope / line.feedrate());
|
||||
if (rate_start < line.volumetric_extrusion_rate_start) {
|
||||
// Limit the volumetric extrusion rate at the start of this segment due to a segment
|
||||
// of ExtrusionType iRole, which will be extruded in the future.
|
||||
@ -699,7 +699,7 @@ void PressureEqualizer::adjust_volumetric_rate(const size_t first_line_idx, cons
|
||||
}
|
||||
|
||||
if (line.adjustable_flow) {
|
||||
float rate_end = rate_start + rate_slope * line.time_corrected();
|
||||
float rate_end = sqrt(rate_start * rate_start + 2 * line.volumetric_extrusion_rate * line.dist_xyz() * rate_slope / line.feedrate());
|
||||
if (rate_end < line.volumetric_extrusion_rate_end) {
|
||||
// Limit the volumetric extrusion rate at the start of this segment due to a segment
|
||||
// of ExtrusionType iRole, which was extruded before.
|
||||
@ -778,8 +778,10 @@ inline bool is_just_line_with_extrude_set_speed_tag(const std::string &line)
|
||||
return p_line <= line_end && is_eol(*p_line);
|
||||
}
|
||||
|
||||
void PressureEqualizer::push_line_to_output(const size_t line_idx, const float new_feedrate, const char *comment)
|
||||
{
|
||||
void PressureEqualizer::push_line_to_output(const size_t line_idx, float new_feedrate, const char *comment) {
|
||||
// Ensure the minimum feedrate will not be below 1 mm/s.
|
||||
new_feedrate = std::max(60.f, new_feedrate);
|
||||
|
||||
const GCodeLine &line = m_gcode_lines[line_idx];
|
||||
if (line_idx > 0 && output_buffer_length > 0) {
|
||||
const std::string prev_line_str = std::string(output_buffer.begin() + int(this->output_buffer_prev_length),
|
||||
|
@ -133,8 +133,9 @@ private:
|
||||
float feedrate() const { return pos_end[4]; }
|
||||
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;
|
||||
float volumetric_correction_avg() const {
|
||||
// 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user