mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-27 00:24:00 -06:00
Fix z hop performed after retraction in PA pattern calibration. Fix z hop config value not used (#6245)
* Fix z hop performed after retraction in PA pattern calibration. Fix zhop config value not used * Updated gathering of z hop value method for consistency
This commit is contained in:
parent
cbda70ae73
commit
dcabdb8b77
2 changed files with 18 additions and 19 deletions
|
@ -18,13 +18,19 @@ float CalibPressureAdvance::find_optimal_PA_speed(const DynamicPrintConfig &conf
|
|||
return std::floor(pa_speed);
|
||||
}
|
||||
|
||||
std::string CalibPressureAdvance::move_to(Vec2d pt, GCodeWriter &writer, std::string comment)
|
||||
std::string CalibPressureAdvance::move_to(Vec2d pt, GCodeWriter &writer, std::string comment, double z, double layer_height)
|
||||
{
|
||||
std::stringstream gcode;
|
||||
|
||||
gcode << writer.retract();
|
||||
gcode << writer.travel_to_xy(pt, comment);
|
||||
gcode << writer.unretract();
|
||||
gcode << writer.retract(); // retract before z move or move
|
||||
if(z > EPSILON && layer_height >= 0){
|
||||
gcode << writer.travel_to_z(z, "z-hop"); // Perform z hop
|
||||
gcode << writer.travel_to_xy(pt, comment); // Travel with z move
|
||||
gcode << writer.travel_to_z(layer_height, "undo z-hop"); // Undo z hop
|
||||
}else {
|
||||
gcode << writer.travel_to_xy(pt, comment);
|
||||
}
|
||||
gcode << writer.unretract(); // unretract after z move is complete
|
||||
|
||||
m_last_pos = Vec3d(pt.x(), pt.y(), 0);
|
||||
|
||||
|
@ -565,10 +571,11 @@ void CalibPressureAdvancePattern::generate_custom_gcodes(const DynamicPrintConfi
|
|||
std::vector<CustomGCode::Item> gcode_items;
|
||||
const int num_patterns = get_num_patterns(); // "cache" for use in loops
|
||||
|
||||
const double zhop_config_value = m_config.option<ConfigOptionFloats>("z_hop")->get_at(0);
|
||||
// draw pressure advance pattern
|
||||
for (int i = 0; i < m_num_layers; ++i) {
|
||||
const double layer_height = height_first_layer() + height_z_offset() + (i * height_layer());
|
||||
const double zhop_height = layer_height + height_layer();
|
||||
const double zhop_height = layer_height + zhop_config_value;
|
||||
|
||||
if (i > 0) {
|
||||
gcode << "; end pressure advance pattern for layer\n";
|
||||
|
@ -619,9 +626,7 @@ void CalibPressureAdvancePattern::generate_custom_gcodes(const DynamicPrintConfi
|
|||
double initial_x = to_x;
|
||||
double initial_y = to_y;
|
||||
|
||||
gcode << m_writer.travel_to_z(zhop_height, "z-hop before move");
|
||||
gcode << move_to(Vec2d(to_x, to_y), m_writer, "Move to pattern start");
|
||||
gcode << m_writer.travel_to_z(layer_height, "undo z-hop");
|
||||
gcode << move_to(Vec2d(to_x, to_y), m_writer, "Move to pattern start",zhop_height,layer_height);
|
||||
|
||||
for (int j = 0; j < num_patterns; ++j) {
|
||||
// increment pressure advance
|
||||
|
@ -646,22 +651,16 @@ void CalibPressureAdvancePattern::generate_custom_gcodes(const DynamicPrintConfi
|
|||
if (k != wall_count() - 1) {
|
||||
// perimeters not done yet. move to next perimeter
|
||||
to_x += line_spacing_angle();
|
||||
gcode << m_writer.travel_to_z(zhop_height, "z-hop before move");
|
||||
gcode << move_to(Vec2d(to_x, to_y), m_writer, "Move to start next pattern wall");
|
||||
gcode << m_writer.travel_to_z(layer_height, "undo z-hop");
|
||||
gcode << move_to(Vec2d(to_x, to_y), m_writer, "Move to start next pattern wall", zhop_height, layer_height); // Call move to command with XY as well as z hop and layer height to invoke and undo z lift
|
||||
} else if (j != num_patterns - 1) {
|
||||
// patterns not done yet. move to next pattern
|
||||
to_x += m_pattern_spacing + line_width();
|
||||
gcode << m_writer.travel_to_z(zhop_height, "z-hop before move");
|
||||
gcode << move_to(Vec2d(to_x, to_y), m_writer, "Move to next pattern");
|
||||
gcode << m_writer.travel_to_z(layer_height, "undo z-hop");
|
||||
gcode << move_to(Vec2d(to_x, to_y), m_writer, "Move to next pattern", zhop_height, layer_height); // Call move to command with XY as well as z hop and layer height to invoke and undo z lift
|
||||
} else if (i != m_num_layers - 1) {
|
||||
// layers not done yet. move back to start
|
||||
to_x = initial_x;
|
||||
gcode << m_writer.travel_to_z(zhop_height, "z-hop before move");
|
||||
gcode << move_to(Vec2d(to_x, to_y), m_writer, "Move back to start position");
|
||||
gcode << m_writer.travel_to_z(layer_height, "undo z-hop");
|
||||
gcode << m_writer.reset_e(); // reset extruder before printing placeholder cube to avoid
|
||||
gcode << move_to(Vec2d(to_x, to_y), m_writer, "Move back to start position", zhop_height, layer_height); // Call move to command with XY as well as z hop and layer height to invoke and undo z lift
|
||||
gcode << m_writer.reset_e(); // reset extruder before printing placeholder cube to avoid over extrusion
|
||||
} else {
|
||||
// everything done
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue