diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2020-08-16 14:40:04 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2020-08-20 21:03:22 -0400 |
commit | cd7c1b8e68d8234524149c62e8ea2ad0bda07d2f (patch) | |
tree | 0b394c07eb46712a7d8414d7a2304bab60ea1eef /klippy/toolhead.py | |
parent | 80a6f59c8f4549e80aeac0b20ed3a648b284e447 (diff) | |
download | kutter-cd7c1b8e68d8234524149c62e8ea2ad0bda07d2f.tar.gz kutter-cd7c1b8e68d8234524149c62e8ea2ad0bda07d2f.tar.xz kutter-cd7c1b8e68d8234524149c62e8ea2ad0bda07d2f.zip |
toolhead: Move G4 and M400 commands from gcode.py to toolhead.py
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r-- | klippy/toolhead.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py index fedcf481..c0b72d84 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -259,8 +259,10 @@ class ToolHead: msg = "Error loading kinematics '%s'" % (kin_name,) logging.exception(msg) raise config.error(msg) - # SET_VELOCITY_LIMIT command + # Register commands gcode = self.printer.lookup_object('gcode') + gcode.register_command('G4', self.cmd_G4) + gcode.register_command('M400', self.cmd_M400) gcode.register_command('SET_VELOCITY_LIMIT', self.cmd_SET_VELOCITY_LIMIT, desc=self.cmd_SET_VELOCITY_LIMIT_help) @@ -540,6 +542,13 @@ class ToolHead: self.junction_deviation = scv2 * (math.sqrt(2.) - 1.) / self.max_accel self.max_accel_to_decel = min(self.requested_accel_to_decel, self.max_accel) + def cmd_G4(self, gcmd): + # Dwell + delay = gcmd.get_float('P', 0., minval=0.) / 1000. + self.dwell(delay) + def cmd_M400(self, gcmd): + # Wait for current moves to finish + self.wait_moves() cmd_SET_VELOCITY_LIMIT_help = "Set printer velocity limits" def cmd_SET_VELOCITY_LIMIT(self, gcmd): print_time = self.get_last_move_time() |