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

Add z offset to pressure advance calibration (line and pattern) #4434

Merged
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions src/libslic3r/calib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ std::string CalibPressureAdvanceLine::print_pa_lines(double start_x, double star

const auto filament_diameter = config.filament_diameter.get_at(0);
const auto print_flow_ratio = config.print_flow_ratio;
const auto z_offset = config.z_offset;

const double e_per_mm = CalibPressureAdvance::e_per_mm(m_line_width, m_height_layer, m_nozzle_diameter, filament_diameter,
print_flow_ratio);
Expand All @@ -472,7 +473,7 @@ std::string CalibPressureAdvanceLine::print_pa_lines(double start_x, double star
const double fast = CalibPressureAdvance::speed_adjust(m_fast_speed);
const double slow = CalibPressureAdvance::speed_adjust(m_slow_speed);
std::stringstream gcode;
gcode << mp_gcodegen->writer().travel_to_z(m_height_layer);
gcode << mp_gcodegen->writer().travel_to_z(m_height_layer + z_offset);
double y_pos = start_y;

// prime line
Expand Down Expand Up @@ -508,7 +509,7 @@ std::string CalibPressureAdvanceLine::print_pa_lines(double start_x, double star
default_box_opt_args.is_filled = true;
gcode << draw_box(writer, box_start_x, start_y - m_space_y,
number_spacing() * 8, (num + 1) * m_space_y, default_box_opt_args);
gcode << writer.travel_to_z(m_height_layer*2);
gcode << writer.travel_to_z(m_height_layer*2 + z_offset);
for (int i = 0; i < num; i += 2) {
gcode << draw_number(box_start_x + 3 + m_line_width, y_pos + i * m_space_y + m_space_y / 2, start_pa + i * step_pa, m_draw_digit_mode,
m_number_line_width, number_e_per_mm, 3600, writer);
Expand Down Expand Up @@ -543,7 +544,7 @@ void CalibPressureAdvancePattern::generate_custom_gcodes(const DynamicPrintConfi
refresh_setup(config, is_bbl_machine, model, origin);

gcode << move_to(Vec2d(m_starting_point.x(), m_starting_point.y()), m_writer, "Move to start XY position");
gcode << m_writer.travel_to_z(height_first_layer(), "Move to start Z position");
gcode << m_writer.travel_to_z(height_first_layer() + height_z_offset(), "Move to start Z position");
gcode << m_writer.set_pressure_advance(m_params.start);

const DrawBoxOptArgs default_box_opt_args(wall_count(), height_first_layer(), line_width_first_layer(),
Expand All @@ -565,7 +566,7 @@ void CalibPressureAdvancePattern::generate_custom_gcodes(const DynamicPrintConfi

// draw pressure advance pattern
for (int i = 0; i < m_num_layers; ++i) {
const double layer_height = height_first_layer() + (i * height_layer());
const double layer_height = height_first_layer() + height_z_offset() + (i * height_layer());
const double zhop_height = layer_height + height_layer();

if (i > 0) {
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/calib.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ class CalibPressureAdvancePattern : public CalibPressureAdvance
void _refresh_writer(bool is_bbl_machine, const Model &model, const Vec3d &origin);

double height_first_layer() const { return m_config.option<ConfigOptionFloat>("initial_layer_print_height")->value; };
double height_z_offset() const { return m_config.option<ConfigOptionFloat>("z_offset")->value; };
double height_layer() const { return m_config.option<ConfigOptionFloat>("layer_height")->value; };
const int get_num_patterns() const { return std::ceil((m_params.end - m_params.start) / m_params.step + 1); }

Expand Down