vzbot330-klipper/sensorless.cfg
2023-01-29 17:30:55 -08:00

92 lines
2.5 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
# Pause to ensure driver stall flag is clear
G4 P2200
# Home
G28 X0
# Move away
G90
G1 x60 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
[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_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_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 = params.X is not defined and params.Y is not defined and params.Z is not defined %}
{% if params.Y is defined or home_all %}
{% if "x" in printer.toolhead.homed_axes %}
G90
G1 x20
G91
{% else %}
SENSORLESS_HOME_X
{% endif %}
SENSORLESS_HOME_Y
{% else %}
{% if params.X is defined or home_all %}
SENSORLESS_HOME_X
{% endif %}
{% endif %}
{% if params.Z is defined or home_all %}
{action_respond_info("Doing G28 Z0")}
# You can do your logic for safe z here
G4 P2200
G90
G1 x300 y241 F{800*60}
# Belt is tight on the edge. Go slow to reach the endstop.
G1 x327.5 y240 F{30*60}
SET_GCODE_OFFSET Z=0.0 # Reset offset before homing Z
G28 Z0
G1 Z{Z}
G91
{% endif %}