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

This commit is contained in:
GrannyShifting 2024-04-04 06:41:05 -07:00 committed by GitHub
parent b38133fd90
commit 1dc9caf19d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View file

@ -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);
@ -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
@ -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);
@ -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(),
@ -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) {

View file

@ -268,6 +268,7 @@ private:
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); }