From 98068beca0a3bbe8594f309d2fa6152b71baac49 Mon Sep 17 00:00:00 2001 From: GofranChang <36130357+GofranChang@users.noreply.github.com> Date: Fri, 28 Feb 2025 02:18:59 +0800 Subject: [PATCH] =?UTF-8?q?skew=5Fcorrection:=20Supports=20retrieving=20th?= =?UTF-8?q?e=20name=20of=20the=20currently=20loaded=20skew=20correction=20?= =?UTF-8?q?=E2=80=A6=20(#6821)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Zhang Gaofan --- docs/Status_Reference.md | 6 ++++++ klippy/extras/skew_correction.py | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/Status_Reference.md b/docs/Status_Reference.md index ee8099025c95..a40e1ab29121 100644 --- a/docs/Status_Reference.md +++ b/docs/Status_Reference.md @@ -447,6 +447,12 @@ The following information is available in - `printer["servo "].value`: The last setting of the PWM pin (a value between 0.0 and 1.0) associated with the servo. +## skew_correction.py + +The following information is available in the `skew_correction` object (this +object is available if any skew_correction is defined): +- `current_profile_name`: Returns the name of the currently loaded SKEW_PROFILE. + ## stepper_enable The following information is available in the `stepper_enable` object (this diff --git a/klippy/extras/skew_correction.py b/klippy/extras/skew_correction.py index f9a292060316..6a2cbd2951f5 100644 --- a/klippy/extras/skew_correction.py +++ b/klippy/extras/skew_correction.py @@ -20,6 +20,7 @@ class PrinterSkew: def __init__(self, config): self.printer = config.get_printer() self.name = config.get_name() + self.current_profile_name = "" self.toolhead = None self.xy_factor = 0. self.xz_factor = 0. @@ -117,6 +118,7 @@ def cmd_SET_SKEW(self, gcmd): def cmd_SKEW_PROFILE(self, gcmd): if gcmd.get('LOAD', None) is not None: name = gcmd.get('LOAD') + self.current_profile_name = name prof = self.skew_profiles.get(name) if prof is None: gcmd.respond_info( @@ -156,7 +158,10 @@ def cmd_SKEW_PROFILE(self, gcmd): gcmd.respond_info( "skew_correction: No profile named [%s] to remove" % (name)) - + def get_status(self, eventtime): + return { + 'current_profile_name': self.current_profile_name + } def load_config(config): return PrinterSkew(config)