Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [homing_override]
- set_position_z: -5 # this is the minimum allowed Z which means the nozzle cannot move closer to the bed, for safety.
- axes: xyz
- gcode:
- {% set x_homed = 'x' in printer.toolhead.homed_axes %}
- {% set y_homed = 'y' in printer.toolhead.homed_axes %}
- {% set safe_home_x = printer["gcode_macro RatOS"].safe_home_x %}
- {% set safe_home_y = printer["gcode_macro RatOS"].safe_home_y %}
- {% if safe_home_x is not defined or safe_home_x|lower == 'middle' %}
- {% set safe_home_x = printer.toolhead.axis_maximum.x / 2 %}
- {% endif %}
- {% if safe_home_y is not defined or safe_home_y|lower == 'middle' %}
- {% set safe_home_y = printer.toolhead.axis_maximum.y / 2 %}
- {% endif %}
- {% set z_hop = printer["gcode_macro RatOS"].homing_z_hop|float %}
- {% set z_probe = printer["gcode_macro RatOS"].z_probe|lower %}
- {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %}
- {% set z_speed = printer["gcode_macro RatOS"].macro_z_speed|float * 60 %}
- M400 # Wait for moves to finish
- G90 # Absolute positioning
- G0 Z{z_hop} F{z_speed} # Hop Z-Axis
- {% if params.X is defined or params.Y is not defined and params.Z is not defined %}
- {% if printer["gcode_macro RatOS"].homing_x|lower == 'endstop' or printer["gcode_macro RatOS"].homing|lower == 'endstops' %}
- G28 X
- {% elif printer["gcode_macro RatOS"].homing_x|lower == 'sensorless' or printer["gcode_macro RatOS"].homing|lower == 'sensorless' %}
- HOME_X_SENSORLESS
- {% endif %}
- {% set x_homed = True %}
- G0 X{safe_home_x} F{speed}
- {% endif %}
- {% if params.Y is defined or params.X is not defined and params.Z is not defined %}
- {% if printer["gcode_macro RatOS"].homing_y|lower == 'endstop' or printer["gcode_macro RatOS"].homing|lower == 'endstops' %}
- G28 Y
- {% elif printer["gcode_macro RatOS"].homing_y|lower == 'sensorless' or printer["gcode_macro RatOS"].homing|lower == 'sensorless' %}
- HOME_Y_SENSORLESS
- {% endif %}
- {% set y_homed = True %}
- G0 Y{safe_home_y} F{speed}
- {% endif %}
- {% if params.Z is defined or params.Y is not defined and params.X is not defined %}
- RESPOND MSG="Homing Z"
- {% if x_homed == False or y_homed == False %}
- M118 X and Y must be homed before homing Z
- {% else %}
- {% if z_probe == "stowable" %}
- DEPLOY_PROBE
- G0 X{safe_home_x} Y{safe_home_y} F{speed}
- G28 Z
- G0 Z{z_hop} F{z_speed}
- STOW_PROBE
- {% else %}
- G0 X{safe_home_x} Y{safe_home_y} F{speed}
- G28 Z
- G0 Z{z_hop} F{z_speed}
- {% endif %}
- {% endif %}
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment