mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-05 21:14:05 -06:00
gcode: Automatically call reset_last_position() on a toolhead set_position()
Generate a "toolhead:set_position" event on a call to toolhead.set_position() and use that event to automatically call gcode.reset_last_position(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
560d48dbc9
commit
4115a77342
8 changed files with 3 additions and 9 deletions
|
@ -76,6 +76,8 @@ class GCodeParser:
|
|||
printer.register_event_handler("klippy:shutdown", self._handle_shutdown)
|
||||
printer.register_event_handler("klippy:disconnect",
|
||||
self._handle_disconnect)
|
||||
printer.register_event_handler("toolhead:set_position",
|
||||
self.reset_last_position)
|
||||
printer.register_event_handler("extruder:activate_extruder",
|
||||
self._handle_activate_extruder)
|
||||
# Command handling
|
||||
|
@ -421,7 +423,6 @@ class GCodeParser:
|
|||
homing_state.home_axes(axes)
|
||||
for axis in homing_state.get_axes():
|
||||
self.base_position[axis] = self.homing_position[axis]
|
||||
self.reset_last_position()
|
||||
def cmd_M400(self, gcmd):
|
||||
# Wait for current moves to finish
|
||||
self.toolhead.wait_moves()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue