Add a new option "emit_machine_limits_to_gcode" (#3236)

This commit is contained in:
SoftFever 2023-12-23 15:02:27 +08:00 committed by GitHub
parent 01706eff84
commit cc23ec6626
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 4 deletions

View file

@ -3026,7 +3026,8 @@ static bool custom_gcode_sets_temperature(const std::string &gcode, const int mc
void GCode::print_machine_envelope(GCodeOutputStream &file, Print &print)
{
const auto flavor = print.config().gcode_flavor.value;
if (flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware) {
if ((flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware || flavor == gcfRepRapFirmware) &&
print.config().emit_machine_limits_to_gcode.value == true) {
int factor = flavor == gcfRepRapFirmware ? 60 : 1; // RRF M203 and M566 are in mm/min
file.write_format("M201 X%d Y%d Z%d E%d\n",
int(print.config().machine_max_acceleration_x.values.front() + 0.5),
@ -3069,7 +3070,6 @@ void GCode::print_machine_envelope(GCodeOutputStream &file, Print &print)
print.config().machine_max_jerk_y.values.front() * factor,
print.config().machine_max_jerk_z.values.front() * factor,
print.config().machine_max_jerk_e.values.front() * factor);
}
}