diff options
author | Hans Raaf <hara@oderwat.de> | 2018-06-10 14:23:40 +0200 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-06-11 20:41:18 -0400 |
commit | e110e1fecc7431187c371224e9235cab9e6a5e71 (patch) | |
tree | 16acb7b8416ccd8e7a63ad15c63d39f631a42f51 | |
parent | 5f640699b7cbb8c4f1a9aec77743622daebb8aab (diff) | |
download | kutter-e110e1fecc7431187c371224e9235cab9e6a5e71.tar.gz kutter-e110e1fecc7431187c371224e9235cab9e6a5e71.tar.xz kutter-e110e1fecc7431187c371224e9235cab9e6a5e71.zip |
homing_override: Add axes config parameter
Added a config parameter to define the homing override axes. This way
one can still home x and y axis without the z-probe cycle coming in the
way.
Signed-off-by: Hans Raaf <hr-klipper@oderwat.de>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | config/example-extras.cfg | 8 | ||||
-rw-r--r-- | klippy/extras/homing_override.py | 22 |
2 files changed, 29 insertions, 1 deletions
diff --git a/config/example-extras.cfg b/config/example-extras.cfg index b849b4c2..81231f75 100644 --- a/config/example-extras.cfg +++ b/config/example-extras.cfg @@ -486,10 +486,16 @@ #[homing_override] #gcode: # A list of G-Code commands (one per line) to execute in place of -# all G28 commands found in the normal g-code input. If a G28 is +# G28 commands found in the normal g-code input. If a G28 is # contained in this list of commands then it will invoke the normal # homing procedure for the printer. The commands listed here must # home all axes. This parameter must be provided. +#axes: xyz +# The axes to override. For example, if this is set to "z" then the +# override script will only be run when the z axis is homed (eg, via +# a "G28" or "G28 Z0" command). Note, the override script should +# still home all axes. The default is "xyz" which causes the +# override script to be run in place of all G28 commands. #set_position_x: #set_position_y: #set_position_z: diff --git a/klippy/extras/homing_override.py b/klippy/extras/homing_override.py index f69298aa..17a3911e 100644 --- a/klippy/extras/homing_override.py +++ b/klippy/extras/homing_override.py @@ -9,6 +9,7 @@ class HomingOverride: self.printer = config.get_printer() self.start_pos = [config.getfloat('set_position_' + a, None) for a in 'xyz'] + self.axes = config.get('axes', 'XYZ').upper() self.script = config.get('gcode') self.in_script = False self.gcode = self.printer.lookup_object('gcode') @@ -19,6 +20,27 @@ class HomingOverride: # Was called recursively - invoke the real G28 command self.gcode.cmd_G28(params) return + + # if no axis is given as parameter we assume the override + no_axis = True + for axis in 'XYZ': + if axis in params: + no_axis = False + break + + if no_axis: + override = True + else: + # check if we home an axsis which needs the override + override = False + for axis in self.axes: + if axis in params: + override = True + + if not override: + self.gcode.cmd_G28(params) + return + # Calculate forced position (if configured) toolhead = self.printer.lookup_object('toolhead') pos = toolhead.get_position() |