Fix wrong z when zhop is diabled.

This commit is contained in:
SoftFever 2024-10-06 19:16:15 +08:00
parent 6f3c701a32
commit 608e6375e6
3 changed files with 11 additions and 14 deletions

View file

@ -440,7 +440,7 @@ std::string GCodeWriter::travel_to_xy(const Vec2d &point, const std::string &com
return w.string();
}
std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &comment)
std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &comment, bool force_z)
{
// FIXME: This function was not being used when travel_speed_z was separated (bd6badf).
// Calculation of feedrate was not updated accordingly. If you want to use
@ -526,7 +526,7 @@ std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &co
this->set_current_position_clear(true);
return slop_move + xy_z_move;
}
else if (!this->will_move_z(point(2))) {
else if (!force_z && !this->will_move_z(point(2))) {
double nominal_z = m_pos(2) - m_lifted;
m_lifted -= (point(2) - nominal_z);
// In case that z_hop == layer_height we could end up with almost zero in_m_lifted