From b5d5b972fc124eb9c7e23bd653da06fc19ad8c61 Mon Sep 17 00:00:00 2001 From: Morton Jonuschat Date: Wed, 26 Jul 2023 04:11:47 -0700 Subject: [PATCH] [BUGFIX] Fix emitting Klipper SET_VELOCITY_LIMIT commands (#1598) [BUGFIX] Fix Klipper SET_VELOCITY_LIMIT code - Always write out SET_VELOCITY_LIMTIT ACCEL= independently of the accel_to_decel setting - Append the ACCEL_TO_DECEL fragment if enabled in config --- src/libslic3r/GCodeWriter.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libslic3r/GCodeWriter.cpp b/src/libslic3r/GCodeWriter.cpp index 2516af7856..77dbb6f454 100644 --- a/src/libslic3r/GCodeWriter.cpp +++ b/src/libslic3r/GCodeWriter.cpp @@ -176,11 +176,13 @@ std::string GCodeWriter::set_acceleration(unsigned int acceleration) // This is new MarlinFirmware with separated print/retraction/travel acceleration. // Use M204 P, we don't want to override travel acc by M204 S (which is deprecated anyway). gcode << "M204 P" << acceleration; - } else if (FLAVOR_IS(gcfKlipper) && this->config.accel_to_decel_enable) { - gcode << "SET_VELOCITY_LIMIT ACCEL=" << acceleration - << " ACCEL_TO_DECEL=" << acceleration * this->config.accel_to_decel_factor / 100; - if (GCodeWriter::full_gcode_comment) - gcode << " ; adjust ACCEL_TO_DECEL"; + } else if (FLAVOR_IS(gcfKlipper)) { + gcode << "SET_VELOCITY_LIMIT ACCEL=" << acceleration; + if (this->config.accel_to_decel_enable) { + gcode << " ACCEL_TO_DECEL=" << acceleration * this->config.accel_to_decel_factor / 100; + if (GCodeWriter::full_gcode_comment) + gcode << " ; adjust ACCEL_TO_DECEL"; + } } else gcode << "M204 S" << acceleration;