From da8d4b02311fef6dccef7cfb6d1a8e09707971c2 Mon Sep 17 00:00:00 2001 From: Pedro Lamas Date: Sat, 4 Feb 2023 15:27:51 +0000 Subject: [PATCH] extruder: store currently sync'ed motion queue name Signed-off-by: Pedro Lamas --- docs/Status_Reference.md | 3 +++ klippy/kinematics/extruder.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/Status_Reference.md b/docs/Status_Reference.md index ef947f5b..778802a5 100644 --- a/docs/Status_Reference.md +++ b/docs/Status_Reference.md @@ -126,6 +126,9 @@ The following information is available for extruder_stepper objects (as well as [extruder](Config_Reference.md#extruder) objects): - `pressure_advance`: The current [pressure advance](Pressure_Advance.md) value. - `smooth_time`: The current pressure advance smooth time. +- `motion_queue`: The name of the extruder that this extruder stepper is + currently synchronized to. This is reported as `None` if the extruder stepper + is not currently associated with an extruder. ## fan diff --git a/klippy/kinematics/extruder.py b/klippy/kinematics/extruder.py index 0af14a65..ea422b6e 100644 --- a/klippy/kinematics/extruder.py +++ b/klippy/kinematics/extruder.py @@ -20,6 +20,7 @@ class ExtruderStepper: self.sk_extruder = ffi_main.gc(ffi_lib.extruder_stepper_alloc(), ffi_lib.free) self.stepper.set_stepper_kinematics(self.sk_extruder) + self.motion_queue = None # Register commands self.printer.register_event_handler("klippy:connect", self._handle_connect) @@ -49,7 +50,8 @@ class ExtruderStepper: self._set_pressure_advance(self.config_pa, self.config_smooth_time) def get_status(self, eventtime): return {'pressure_advance': self.pressure_advance, - 'smooth_time': self.pressure_advance_smooth_time} + 'smooth_time': self.pressure_advance_smooth_time, + 'motion_queue': self.motion_queue} def find_past_position(self, print_time): mcu_pos = self.stepper.get_past_mcu_position(print_time) return self.stepper.mcu_to_commanded_position(mcu_pos) @@ -58,6 +60,7 @@ class ExtruderStepper: toolhead.flush_step_generation() if not extruder_name: self.stepper.set_trapq(None) + self.motion_queue = None return extruder = self.printer.lookup_object(extruder_name, None) if extruder is None or not isinstance(extruder, PrinterExtruder): @@ -65,6 +68,7 @@ class ExtruderStepper: % (extruder_name,)) self.stepper.set_position([extruder.last_position, 0., 0.]) self.stepper.set_trapq(extruder.get_trapq()) + self.motion_queue = extruder_name def _set_pressure_advance(self, pressure_advance, smooth_time): old_smooth_time = self.pressure_advance_smooth_time if not self.pressure_advance: