diff --git a/docs/G-Codes.md b/docs/G-Codes.md index 65f01f9d..844e62de 100644 --- a/docs/G-Codes.md +++ b/docs/G-Codes.md @@ -15,6 +15,7 @@ Klipper supports the following standard G-Code commands: - Set position: `G92 [X] [Y] [Z] [E]` - Set speed factor override percentage: `M220 S` - Set extrude factor override percentage: `M221 S` +- Set acceleration: `M204 S` - Get extruder temperature: `M105` - Set extruder temperature: `M104 [T] [S]` - Set extruder temperature and wait: `M109 [T] S` diff --git a/klippy/toolhead.py b/klippy/toolhead.py index f62a86fe..c1f41b85 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -238,6 +238,7 @@ class ToolHead: gcode = printer.lookup_object('gcode') gcode.register_command('SET_VELOCITY_LIMIT', self.cmd_SET_VELOCITY_LIMIT, desc=self.cmd_SET_VELOCITY_LIMIT_help) + gcode.register_command('M204', self.cmd_M204) # Print time tracking def update_move_time(self, movetime): self.print_time += movetime @@ -436,6 +437,10 @@ class ToolHead: junction_deviation)) self.printer.set_rollover_info("toolhead", "toolhead: %s" % (msg,)) gcode.respond_info(msg) + def cmd_M204(self, params): + gcode = self.printer.lookup_object('gcode') + accel = gcode.get_float('S', params, above=0.) + self.max_accel = min(accel, self.config_max_accel) def add_printer_objects(printer, config): printer.add_object('toolhead', ToolHead(printer, config))