104 lines
3.0 KiB
INI
104 lines
3.0 KiB
INI
# Note you may need to add the following to your printer.cfg somewhere (without the comments of course) for the Kinematic position stuff below to work.
|
|
#[force_move]
|
|
#enable_force_move: True
|
|
|
|
[gcode_macro _HOME_X]
|
|
gcode:
|
|
# Home
|
|
{% set RUN_CURRENT_X = printer.configfile.settings['tmc2209 stepper_x'].run_current|float %}
|
|
{% set RUN_CURRENT_Y = printer.configfile.settings['tmc2209 stepper_y'].run_current|float %}
|
|
{% set HOME_CURRENT = 0.49 %}
|
|
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CURRENT}
|
|
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CURRENT}
|
|
|
|
SET_KINEMATIC_POSITION X=15 SET_HOMED=X
|
|
G91
|
|
G1 X15 F1200
|
|
|
|
# Finish the release move, then let the TMC StallGuard flag clear.
|
|
M400
|
|
G4 P2000
|
|
G28 X
|
|
|
|
# Move away
|
|
G91
|
|
G1 X15 F1200
|
|
|
|
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT_X}
|
|
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT_Y}
|
|
|
|
[gcode_macro _HOME_Y]
|
|
gcode:
|
|
{% set RUN_CURRENT_X = printer.configfile.settings['tmc2209 stepper_x'].run_current|float %}
|
|
{% set RUN_CURRENT_Y = printer.configfile.settings['tmc2209 stepper_y'].run_current|float %}
|
|
{% set HOME_CURRENT = 0.49 %}
|
|
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CURRENT}
|
|
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CURRENT}
|
|
|
|
SET_KINEMATIC_POSITION Y=15 SET_HOMED=Y
|
|
G91
|
|
G1 Y-15 F1200
|
|
|
|
# Y uses the physical endstop on PG9; finish the release move first.
|
|
M400
|
|
|
|
# Home
|
|
G28 Y
|
|
# Move away
|
|
G91
|
|
G1 Y-15 F1200
|
|
|
|
# Restore normal CoreXY motor currents after moving off the endstop.
|
|
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT_X}
|
|
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT_Y}
|
|
|
|
[homing_override]
|
|
axes: xyz
|
|
gcode:
|
|
{% set homed_axes = printer.toolhead.homed_axes|lower %}
|
|
{% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %}
|
|
{% set home_z = home_all or 'Z' in params %}
|
|
{% set home_x = home_all or 'X' in params or (home_z and 'x' not in homed_axes) %}
|
|
{% set home_y = home_all or 'Y' in params or (home_z and 'y' not in homed_axes) %}
|
|
{% set z_was_homed = 'z' in homed_axes %}
|
|
|
|
SAVE_GCODE_STATE NAME=HOMING_OVERRIDE_STATE
|
|
|
|
# Establish clearance before XY motion. If Z was not really homed, the
|
|
# temporary homed flag is explicitly cleared after an XY-only request.
|
|
{% if z_was_homed %}
|
|
{% set lift_z = [printer.toolhead.position.z|float + 5.0, printer.toolhead.axis_maximum.z|float]|min %}
|
|
G90
|
|
G1 Z{lift_z} F600
|
|
{% else %}
|
|
SET_KINEMATIC_POSITION Z=0 SET_HOMED=Z
|
|
G90
|
|
G1 Z5 F600
|
|
{% endif %}
|
|
|
|
{% if home_x %}
|
|
_HOME_X
|
|
{% endif %}
|
|
|
|
{% if home_y %}
|
|
_HOME_Y
|
|
{% endif %}
|
|
|
|
{% if home_z %}
|
|
G90
|
|
G1 X125 Y125 F15000
|
|
G28 Z
|
|
G1 Z10 F1500
|
|
{% elif not z_was_homed %}
|
|
SET_KINEMATIC_POSITION SET_HOMED= CLEAR_HOMED=Z
|
|
{% endif %}
|
|
|
|
RESTORE_GCODE_STATE NAME=HOMING_OVERRIDE_STATE MOVE=0
|
|
|
|
[gcode_macro _CG28]
|
|
description: Homing only if necessary
|
|
gcode:
|
|
{% if "xyz" not in printer.toolhead.homed_axes %}
|
|
G28
|
|
{% endif %}
|