From 4657e0d6701e21336ce3bab3d0a7cdf4e2caa1ac Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 31 May 2021 10:56:57 +0200 Subject: [PATCH] Improvement related to 'separate z travel speed': default to zero = use good old travel speed. This is to ensure backwards compatibility with existing profiles --- src/libslic3r/GCodeWriter.cpp | 11 ++++++++++- src/libslic3r/PrintConfig.cpp | 7 ++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/GCodeWriter.cpp b/src/libslic3r/GCodeWriter.cpp index 40237d619..bbb45c96d 100644 --- a/src/libslic3r/GCodeWriter.cpp +++ b/src/libslic3r/GCodeWriter.cpp @@ -316,6 +316,11 @@ std::string GCodeWriter::travel_to_xy(const Vec2d &point, const std::string &com std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string &comment) { + // 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 + // this function, fix it first. + std::terminate(); + /* If target Z is lower than current Z but higher than nominal Z we don't perform the Z move but we only move in the XY plane and adjust the nominal Z by reducing the lift amount that will be @@ -367,10 +372,14 @@ std::string GCodeWriter::travel_to_z(double z, const std::string &comment) std::string GCodeWriter::_travel_to_z(double z, const std::string &comment) { m_pos(2) = z; + + double speed = this->config.travel_speed_z.value; + if (speed == 0.) + speed = this->config.travel_speed.value; std::ostringstream gcode; gcode << "G1 Z" << XYZF_NUM(z) - << " F" << XYZF_NUM(this->config.travel_speed_z.value * 60.0); + << " F" << XYZF_NUM(speed * 60.0); COMMENT(comment); gcode << "\n"; return gcode.str(); diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index e86e2b52b..617c30aa5 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2740,11 +2740,12 @@ void PrintConfigDef::init_fff_params() def = this->add("travel_speed_z", coFloat); def->label = L("Z travel"); - def->tooltip = L("Speed for movements along the Z axis."); + def->tooltip = L("Speed for movements along the Z axis.\nWhen set to zero, the value " + "is ignored and regular travel speed is used instead."); def->sidetext = L("mm/s"); - def->min = 1; + def->min = 0; def->mode = comAdvanced; - def->set_default_value(new ConfigOptionFloat(12)); + def->set_default_value(new ConfigOptionFloat(0.)); def = this->add("use_firmware_retraction", coBool); def->label = L("Use firmware retraction");