Guest User

Untitled

a guest
Feb 16th, 2023
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. [homing_override]
  2. set_position_z: -5 # this is the minimum allowed Z which means the nozzle cannot move closer to the bed, for safety.
  3. axes: xyz
  4. gcode:
  5. {% set x_homed = 'x' in printer.toolhead.homed_axes %}
  6. {% set y_homed = 'y' in printer.toolhead.homed_axes %}
  7. {% set safe_home_x = printer["gcode_macro RatOS"].safe_home_x %}
  8. {% set safe_home_y = printer["gcode_macro RatOS"].safe_home_y %}
  9. {% if safe_home_x is not defined or safe_home_x|lower == 'middle' %}
  10. {% set safe_home_x = printer.toolhead.axis_maximum.x / 2 %}
  11. {% endif %}
  12. {% if safe_home_y is not defined or safe_home_y|lower == 'middle' %}
  13. {% set safe_home_y = printer.toolhead.axis_maximum.y / 2 %}
  14. {% endif %}
  15. {% set z_hop = printer["gcode_macro RatOS"].homing_z_hop|float %}
  16. {% set z_probe = printer["gcode_macro RatOS"].z_probe|lower %}
  17. {% set speed = printer["gcode_macro RatOS"].macro_travel_speed|float * 60 %}
  18. {% set z_speed = printer["gcode_macro RatOS"].macro_z_speed|float * 60 %}
  19.  
  20. M400 # Wait for moves to finish
  21. G90 # Absolute positioning
  22. G0 Z{z_hop} F{z_speed} # Hop Z-Axis
  23.  
  24. {% if params.X is defined or params.Y is not defined and params.Z is not defined %}
  25. {% if printer["gcode_macro RatOS"].homing_x|lower == 'endstop' or printer["gcode_macro RatOS"].homing|lower == 'endstops' %}
  26. G28 X
  27. {% elif printer["gcode_macro RatOS"].homing_x|lower == 'sensorless' or printer["gcode_macro RatOS"].homing|lower == 'sensorless' %}
  28. HOME_X_SENSORLESS
  29. {% endif %}
  30. {% set x_homed = True %}
  31. G0 X{safe_home_x} F{speed}
  32. {% endif %}
  33.  
  34. {% if params.Y is defined or params.X is not defined and params.Z is not defined %}
  35. {% if printer["gcode_macro RatOS"].homing_y|lower == 'endstop' or printer["gcode_macro RatOS"].homing|lower == 'endstops' %}
  36. G28 Y
  37. {% elif printer["gcode_macro RatOS"].homing_y|lower == 'sensorless' or printer["gcode_macro RatOS"].homing|lower == 'sensorless' %}
  38. HOME_Y_SENSORLESS
  39. {% endif %}
  40. {% set y_homed = True %}
  41. G0 Y{safe_home_y} F{speed}
  42. {% endif %}
  43.  
  44. {% if params.Z is defined or params.Y is not defined and params.X is not defined %}
  45. RESPOND MSG="Homing Z"
  46. {% if x_homed == False or y_homed == False %}
  47. M118 X and Y must be homed before homing Z
  48. {% else %}
  49. {% if z_probe == "stowable" %}
  50. DEPLOY_PROBE
  51. G0 X{safe_home_x} Y{safe_home_y} F{speed}
  52. G28 Z
  53. G0 Z{z_hop} F{z_speed}
  54. STOW_PROBE
  55. {% else %}
  56. G0 X{safe_home_x} Y{safe_home_y} F{speed}
  57. G28 Z
  58. G0 Z{z_hop} F{z_speed}
  59. {% endif %}
  60. {% endif %}
  61. {% endif %}
  62.  
Advertisement
Add Comment
Please, Sign In to add comment