toolhead: Add support for the M204 command

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-06-15 12:00:33 -04:00
parent 4ec1244c31
commit efe63d5efe
2 changed files with 6 additions and 0 deletions

View File

@ -15,6 +15,7 @@ Klipper supports the following standard G-Code commands:
- Set position: `G92 [X<pos>] [Y<pos>] [Z<pos>] [E<pos>]` - Set position: `G92 [X<pos>] [Y<pos>] [Z<pos>] [E<pos>]`
- Set speed factor override percentage: `M220 S<percent>` - Set speed factor override percentage: `M220 S<percent>`
- Set extrude factor override percentage: `M221 S<percent>` - Set extrude factor override percentage: `M221 S<percent>`
- Set acceleration: `M204 S<value>`
- Get extruder temperature: `M105` - Get extruder temperature: `M105`
- Set extruder temperature: `M104 [T<index>] [S<temperature>]` - Set extruder temperature: `M104 [T<index>] [S<temperature>]`
- Set extruder temperature and wait: `M109 [T<index>] S<temperature>` - Set extruder temperature and wait: `M109 [T<index>] S<temperature>`

View File

@ -238,6 +238,7 @@ class ToolHead:
gcode = printer.lookup_object('gcode') gcode = printer.lookup_object('gcode')
gcode.register_command('SET_VELOCITY_LIMIT', self.cmd_SET_VELOCITY_LIMIT, gcode.register_command('SET_VELOCITY_LIMIT', self.cmd_SET_VELOCITY_LIMIT,
desc=self.cmd_SET_VELOCITY_LIMIT_help) desc=self.cmd_SET_VELOCITY_LIMIT_help)
gcode.register_command('M204', self.cmd_M204)
# Print time tracking # Print time tracking
def update_move_time(self, movetime): def update_move_time(self, movetime):
self.print_time += movetime self.print_time += movetime
@ -436,6 +437,10 @@ class ToolHead:
junction_deviation)) junction_deviation))
self.printer.set_rollover_info("toolhead", "toolhead: %s" % (msg,)) self.printer.set_rollover_info("toolhead", "toolhead: %s" % (msg,))
gcode.respond_info(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): def add_printer_objects(printer, config):
printer.add_object('toolhead', ToolHead(printer, config)) printer.add_object('toolhead', ToolHead(printer, config))