From 2caaaea9a4bdd55846cdcf24b0efba60bcdfbd51 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 16 Aug 2020 22:43:03 -0400 Subject: toolhead: Add a manual_move() helper function Add a helper function for submitting relative movements. This function will also automatically ensure gcode.reset_last_position() is called. Signed-off-by: Kevin O'Connor --- klippy/toolhead.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'klippy/toolhead.py') diff --git a/klippy/toolhead.py b/klippy/toolhead.py index cd083a50..74b8f282 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -413,6 +413,13 @@ class ToolHead: self.move_queue.add_move(move) if self.print_time > self.need_check_stall: self._check_stall() + def manual_move(self, coord, speed): + curpos = list(self.commanded_pos) + for i in range(len(coord)): + if coord[i] is not None: + curpos[i] = coord[i] + self.move(curpos, speed) + self.printer.send_event("toolhead:manual_move") def dwell(self, delay): next_print_time = self.get_last_move_time() + max(0., delay) self._update_move_time(next_print_time) -- cgit v1.2.3-70-g09d2