Init
This commit is contained in:
174
macros/homing.cfg
Normal file
174
macros/homing.cfg
Normal file
@@ -0,0 +1,174 @@
|
||||
[gcode_macro MOVE_UP]
|
||||
variable_set_kinematic_z: 20
|
||||
variable_up_z: 10
|
||||
gcode:
|
||||
SAVE_GCODE_STATE NAME=my_move_up_state
|
||||
{% if not 'z' in printer.toolhead.homed_axes %}
|
||||
SET_KINEMATIC_POSITION Z={set_kinematic_z}
|
||||
{% endif %}
|
||||
G91
|
||||
G0 Z{up_z} F1200
|
||||
RESTORE_GCODE_STATE NAME=my_move_up_state
|
||||
|
||||
[gcode_macro _HOME_X]
|
||||
variable_homing_current: 0.49
|
||||
variable_start_retract: 15
|
||||
gcode:
|
||||
# Always use consistent run_current on A/B steppers during sensorless homing
|
||||
{% set RUN_CURRENT_X = printer.configfile.settings['tmc2240 stepper_x'].run_current|float %}
|
||||
{% set RUN_CURRENT_Y = printer.configfile.settings['tmc2240 stepper_y'].run_current|float %}
|
||||
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={homing_current}
|
||||
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={homing_current}
|
||||
|
||||
M117 Homing X...
|
||||
|
||||
SET_KINEMATIC_POSITION X={start_retract}
|
||||
G91
|
||||
G1 X-{start_retract} F1200
|
||||
|
||||
M400
|
||||
G28 X
|
||||
|
||||
G91
|
||||
G1 X-40 F1200
|
||||
#G4 P500
|
||||
|
||||
M117
|
||||
|
||||
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT_X}
|
||||
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT_Y}
|
||||
|
||||
|
||||
[gcode_macro _HOME_Y]
|
||||
variable_homing_current: 0.49
|
||||
variable_start_retract: 15
|
||||
gcode:
|
||||
# Set current for sensorless homing
|
||||
{% set RUN_CURRENT_X = printer.configfile.settings['tmc2240 stepper_x'].run_current|float %}
|
||||
{% set RUN_CURRENT_Y = printer.configfile.settings['tmc2240 stepper_y'].run_current|float %}
|
||||
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={homing_current}
|
||||
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={homing_current}
|
||||
#SET_TMC_FIELD FIELD=SGT STEPPER=stepper_x VALUE=1
|
||||
#G4 P1000
|
||||
|
||||
M117 Homing Y...
|
||||
|
||||
SET_KINEMATIC_POSITION Y={start_retract}
|
||||
G91
|
||||
G1 Y-{start_retract} F1200
|
||||
|
||||
M400
|
||||
G28 Y
|
||||
|
||||
G91
|
||||
G1 Y-10 F1200
|
||||
#G4 P500
|
||||
|
||||
M117
|
||||
# Set current during print
|
||||
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 home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %}
|
||||
{% set move_x = params.X|default(printer.toolhead.axis_maximum.y/2)|int %}
|
||||
{% set move_y = params.Y|default(printer.toolhead.axis_maximum.y/2)|int %}
|
||||
{% if params.Z == '' %}
|
||||
{% set move_z = 10 %}
|
||||
{% else %}
|
||||
{% set move_z = params.Z|default(10)|int %}
|
||||
{% endif %}
|
||||
|
||||
SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=homing VALUE=True
|
||||
STATUS_HOMING
|
||||
|
||||
{% if home_all or 'X' or 'Y' in params %}
|
||||
INIT_TMC STEPPER=stepper_y
|
||||
INIT_TMC STEPPER=stepper_x
|
||||
{% endif %}
|
||||
|
||||
{% if home_all or 'Z' in params %}
|
||||
BED_MESH_CLEAR
|
||||
MOVE_UP
|
||||
{% endif %}
|
||||
|
||||
{% if home_all or 'X' in params %}
|
||||
_HOME_X
|
||||
{% endif %}
|
||||
|
||||
{% if home_all or 'Y' in params %}
|
||||
_HOME_Y
|
||||
{% endif %}
|
||||
|
||||
|
||||
G90
|
||||
|
||||
{% if home_all or 'Z' in params %}
|
||||
G1 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_maximum.y/2} F12000 #probe point
|
||||
G28 Z
|
||||
G1 Z{move_z} F1200
|
||||
{% endif %}
|
||||
|
||||
#{ action_respond_info("Move X,Y => {},{}".format(params.X,params.Y)) }
|
||||
|
||||
{% if params.X %}
|
||||
|
||||
G1 X{move_x} F12000
|
||||
{% endif %}
|
||||
|
||||
{% if params.Y %}
|
||||
G1 Y{move_y} F12000
|
||||
{% endif %}
|
||||
|
||||
STATUS_OFF
|
||||
SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=homing VALUE=False
|
||||
|
||||
[gcode_macro CG28]
|
||||
gcode:
|
||||
{% if "xyz" not in printer.toolhead.homed_axes %}
|
||||
G28
|
||||
{% endif %}
|
||||
|
||||
[gcode_macro PARKFRONT]
|
||||
gcode:
|
||||
CG28 ; home if not already homed
|
||||
SAVE_GCODE_STATE NAME=PARKFRONT
|
||||
G90 ; absolute positioning
|
||||
G0 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+5} Z{printer.toolhead.axis_maximum.z/2} F6000
|
||||
RESTORE_GCODE_STATE NAME=PARKFRONT
|
||||
|
||||
[gcode_macro PARKFRONTLOW]
|
||||
gcode:
|
||||
CG28 ; home if not already homed
|
||||
SAVE_GCODE_STATE NAME=PARKFRONT
|
||||
G90 ; absolute positioning
|
||||
G0 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+5} Z20 F6000
|
||||
RESTORE_GCODE_STATE NAME=PARKFRONT
|
||||
|
||||
[gcode_macro PARKREAR]
|
||||
gcode:
|
||||
CG28 ; home if not already homed
|
||||
SAVE_GCODE_STATE NAME=PARKREAR
|
||||
G90 ; absolute positioning
|
||||
G0 X{printer.toolhead.axis_minimum.x+10} Y{printer.toolhead.axis_maximum.y-10} Z{printer.toolhead.axis_maximum.z-50} F6000
|
||||
RESTORE_GCODE_STATE NAME=PARKREAR
|
||||
|
||||
[gcode_macro PARKCENTER]
|
||||
gcode:
|
||||
CG28 ; home if not already homed
|
||||
SAVE_GCODE_STATE NAME=PARKCENTER
|
||||
G90 ; absolute positioning
|
||||
G0 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_maximum.y/2} Z{printer.toolhead.axis_maximum.z/2} F6000
|
||||
RESTORE_GCODE_STATE NAME=PARKCENTER
|
||||
|
||||
[gcode_macro PARKBED]
|
||||
gcode:
|
||||
CG28 ; home if not already homed
|
||||
SAVE_GCODE_STATE NAME=PARKBED
|
||||
G90 ; absolute positioning
|
||||
G0 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_maximum.y/2} Z15 F6000
|
||||
RESTORE_GCODE_STATE NAME=PARKBED
|
||||
|
||||
Reference in New Issue
Block a user