vzbot330-klipper/sensorless.cfg
2024-05-12 18:16:09 -07:00

89 lines
2.6 KiB
INI

[gcode_macro SENSORLESS_HOME_X]
gcode:
# Do not change -> if so do sensorless tuning again
{% set HOME_CUR = 0.750 %}
# End
{% set driver_config = printer.configfile.settings['tmc2209 stepper_x'] %}
{% set RUN_CUR = driver_config.run_current %}
{action_respond_info("Sensorless home x")}
# Set current for sensorless homing
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CUR}
SET_TMC_CURRENT STEPPER=stepper_x1 CURRENT={HOME_CUR} # AWD
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CUR}
SET_TMC_CURRENT STEPPER=stepper_y1 CURRENT={HOME_CUR} # AWD
# Pause to ensure driver stall flag is clear
G4 P2200
# Home
G28 X0
# Move away
G90
G1 x20 F{20*60}
G91
# Set current during print
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CUR}
SET_TMC_CURRENT STEPPER=stepper_x1 CURRENT={RUN_CUR} # AWD
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CUR}
SET_TMC_CURRENT STEPPER=stepper_y1 CURRENT={RUN_CUR} # AWD
[gcode_macro SENSORLESS_HOME_Y]
gcode:
# Do not change -> if so do sensorless tuning again
{% set HOME_CUR = 0.800 %}
# End
{% set driver_config = printer.configfile.settings['tmc2209 stepper_y'] %}
{% set RUN_CUR = driver_config.run_current %}
{action_respond_info("Sensorless home Y")}
# Set current for sensorless homing
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CUR}
SET_TMC_CURRENT STEPPER=stepper_x1 CURRENT={HOME_CUR} # AWD
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CUR}
SET_TMC_CURRENT STEPPER=stepper_y1 CURRENT={HOME_CUR} # AWD
# Pause to ensure driver stall flag is clear
G4 P2200
# Home
G28 Y0
# Move away
G91
G1 Y-10 F{20*60}
G90
# Set current during print
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CUR}
SET_TMC_CURRENT STEPPER=stepper_x1 CURRENT={RUN_CUR} # AWD
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CUR}
SET_TMC_CURRENT STEPPER=stepper_y1 CURRENT={RUN_CUR} # AWD
[homing_override]
axes: xyz
set_position_z: -1.8
gcode:
# Parameters
{% set Z = 20 %}
G90
G1 Z{Z} # Z lift
{% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %}
{% if home_all or 'X' in params %}
SENSORLESS_HOME_X
{% endif %}
{% if home_all or 'Y' in params %}
SENSORLESS_HOME_Y
{% endif %}
{% if home_all or 'Z' in params %}
G4 P2200
G90
G1 x300 y226 F{800*60}
# Belt is tight on the edge. Go slow to reach the endstop.
G1 x327 y227 F{30*60}
SET_GCODE_OFFSET Z=0.0 # Reset offset before homing Z
G28 Z0
G1 Z{Z}
G91
{% endif %}