[BUGFIX] Fix emitting Klipper SET_VELOCITY_LIMIT commands (#1598)

[BUGFIX] Fix Klipper SET_VELOCITY_LIMIT code

- Always write out SET_VELOCITY_LIMTIT ACCEL=<acceleration> independently of the accel_to_decel setting
- Append the ACCEL_TO_DECEL fragment if enabled in config
This commit is contained in:
Morton Jonuschat 2023-07-26 04:11:47 -07:00 committed by GitHub
parent 7f6f01c4c9
commit b5d5b972fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -176,11 +176,13 @@ std::string GCodeWriter::set_acceleration(unsigned int acceleration)
// This is new MarlinFirmware with separated print/retraction/travel 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). // Use M204 P, we don't want to override travel acc by M204 S (which is deprecated anyway).
gcode << "M204 P" << acceleration; gcode << "M204 P" << acceleration;
} else if (FLAVOR_IS(gcfKlipper) && this->config.accel_to_decel_enable) { } else if (FLAVOR_IS(gcfKlipper)) {
gcode << "SET_VELOCITY_LIMIT ACCEL=" << acceleration gcode << "SET_VELOCITY_LIMIT ACCEL=" << acceleration;
<< " ACCEL_TO_DECEL=" << acceleration * this->config.accel_to_decel_factor / 100; if (this->config.accel_to_decel_enable) {
if (GCodeWriter::full_gcode_comment) gcode << " ACCEL_TO_DECEL=" << acceleration * this->config.accel_to_decel_factor / 100;
gcode << " ; adjust ACCEL_TO_DECEL"; if (GCodeWriter::full_gcode_comment)
gcode << " ; adjust ACCEL_TO_DECEL";
}
} else } else
gcode << "M204 S" << acceleration; gcode << "M204 S" << acceleration;