Skip to content

Commit

Permalink
skew_correction: Supports retrieving the name of the currently loaded…
Browse files Browse the repository at this point in the history
… skew correction … (#6821)

Signed-off-by: Zhang Gaofan <zhanggaofan0827@gmail.com>
  • Loading branch information
GofranChang authored Feb 27, 2025
1 parent 3c1bf4c commit 98068be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/Status_Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,12 @@ The following information is available in
- `printer["servo <config_name>"].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
Expand Down
7 changes: 6 additions & 1 deletion klippy/extras/skew_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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)

0 comments on commit 98068be

Please sign in to comment.