tri-zero/sensorless.cfg
2024-11-05 10:06:43 -08:00

73 lines
2 KiB
INI

[gcode_macro SENSORLESS_HOME_X]
gcode:
{% set HOME_CUR = 0.700 %}
{% set driver_config = printer.configfile.settings['tmc2209 stepper_x'] %}
{% set RUN_CUR = driver_config.run_current %}
# Set current for sensorless homing
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CUR}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CUR}
# Pause to ensure driver stall flag is clear
G4 P2000
# Home
G28 X0
# Move away
G91
G1 X5 F{400*60} # dodge probe
# Set current during print
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CUR}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CUR}
G90
[gcode_macro SENSORLESS_HOME_Y]
gcode:
{% set HOME_CUR = 0.700 %}
{% set driver_config = printer.configfile.settings['tmc2209 stepper_y'] %}
{% set RUN_CUR = driver_config.run_current %}
# Set current for sensorless homing
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CUR}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CUR}
# Pause to ensure driver stall flag is clear
G4 P2000
# Home
G28 Y0
# Move away
G91
G1 Y-5 F{400*60}
# Set current during print
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CUR}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CUR}
G90
[gcode_macro HOME]
gcode:
G90
# Home Y
SENSORLESS_HOME_Y
# Home X
SENSORLESS_HOME_X
# Home Z
G28 Z0
[homing_override]
axes: xyz
gcode:
{% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %}
{% if home_all or 'Y' in params %}
SENSORLESS_HOME_Y
{% endif %}
{% if home_all or 'X' in params %}
SENSORLESS_HOME_X
{% endif %}
{% if home_all or 'Z' in params %}
G90 # Absolute positioning
# park above bed center
G1 X{(printer.toolhead.axis_maximum.x/2)-10} Y{(printer.toolhead.axis_maximum.y/2)+2.4}
G28 Z
G91
{% endif %}
G90