fix: PA pattern calibration crash with first layer line width 0 (#14447)

CalibPressureAdvancePattern::line_width_first_layer() returned the raw
initial_layer_line_width, so a value of 0 (which means "use the default")
fed 0 into the Flow spacing math and threw FlowErrorNegativeSpacing,
crashing the whole app when slicing a PA pattern calibration.

Mirror the guard already present in the sibling line_width(): when the
configured width is non-positive, fall back to auto_extrusion_width.

Add a libslic3r regression test covering the width resolution.

Fixes #13188
This commit is contained in:
raistlin7447
2026-06-28 19:22:23 -06:00
committed by GitHub
parent ae2c36f091
commit f13f67959c
4 changed files with 52 additions and 6 deletions

View File

@@ -756,6 +756,16 @@ Vec3d CalibPressureAdvancePattern::get_start_offset()
return m_starting_point;
}
double CalibPressureAdvancePattern::line_width_first_layer() const
{
// TODO: FIXME: find out current filament/extruder?
const double nozzle_diameter = m_config.opt_float("nozzle_diameter", m_params.extruder_id);
const double width = m_config.get_abs_value("initial_layer_line_width", nozzle_diameter);
if (width <= 0.)
return Flow::auto_extrusion_width(frExternalPerimeter, nozzle_diameter);
return width;
};
double CalibPressureAdvancePattern::line_width() const
{
// TODO: FIXME: find out current filament/extruder?

View File

@@ -315,12 +315,7 @@ protected:
double speed_first_layer() const { return m_config.get_abs_value_at("initial_layer_speed", m_params.extruder_id); };
double speed_perimeter() const { return m_config.get_abs_value_at("outer_wall_speed", m_params.extruder_id); };
double accel_perimeter() const { return m_config.get_abs_value_at("outer_wall_acceleration", m_params.extruder_id); }
double line_width_first_layer() const
{
// TODO: FIXME: find out current filament/extruder?
const double nozzle_diameter = m_config.opt_float("nozzle_diameter", m_params.extruder_id);
return m_config.get_abs_value("initial_layer_line_width", nozzle_diameter);
};
double line_width_first_layer() const;
double line_width() const;
int wall_count() const { return m_config.option<ConfigOptionInt>("wall_loops")->value; };