### Homing [gcode_macro SET_CENTER_KINEMATIC_POSITION] description: FOR DEBUGGING PURPOSES ONLY. Sets the internal printer kinematic state to the center of all axes regardless of actual physical position. gcode: RESPOND MSG="WARNING: ONLY USE SET_CENTER_KINEMATIC_POSITION FOR DEBUGGING PURPOSES. YOU'RE OVERRIDING THE INTERNAL POSITIONING STATE OF THE PRINTER. PROCEED WITH CAUTION AND DO A PROPER G28 WHEN DONE." SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=True SET_KINEMATIC_POSITION X={printer.toolhead.axis_maximum.x / 2} Y={printer.toolhead.axis_maximum.y / 2} Z={printer.toolhead.axis_maximum.z / 2} [gcode_macro MAYBE_HOME] description: Only home unhomed axis variable_is_kinematic_position_overriden: False gcode: {% if printer["gcode_macro MAYBE_HOME"].is_kinematic_position_overriden|lower == 'true' %} RESPOND MSG="SET_CENTER_KINEMATIC_POSITION has been abused. Homing all axes. Please refrain from using SET_CENTER_KINEMATIC_POSITION outside of debugging purposes." G28 SET_GCODE_VARIABLE MACRO=MAYBE_HOME VARIABLE=is_kinematic_position_overriden VALUE=False {% else %} {% set axes = '' %} {% set isHomed = true %} {% set axesToHome = '' %} {% if params.X is defined %} {% set axes = axes ~ 'X ' %} {% if 'x' not in printer.toolhead.homed_axes %} {% set isHomed = false %} {% set axesToHome = axesToHome ~ 'X ' %} {% endif %} {% endif %} {% if params.Y is defined %} {% set axes = axes ~ 'Y ' %} {% if 'y' not in printer.toolhead.homed_axes %} {% set isHomed = false %} {% set axesToHome = axesToHome ~ 'Y ' %} {% endif %} {% endif %} {% if params.Z is defined %} {% set axes = axes ~ 'Z ' %} {% if 'z' not in printer.toolhead.homed_axes %} {% set isHomed = false %} {% set axesToHome = axesToHome ~ 'Z ' %} {% endif %} {% endif %} {% if params.X is not defined and params.Y is not defined and params.Z is not defined %} {% set axes = '' %} {% if 'x' not in printer.toolhead.homed_axes %} {% set isHomed = false %} {% set axesToHome = axesToHome ~ 'X ' %} {% endif %} {% if 'y' not in printer.toolhead.homed_axes %} {% set isHomed = false %} {% set axesToHome = axesToHome ~ 'Y ' %} {% endif %} {% if 'z' not in printer.toolhead.homed_axes %} {% set isHomed = false %} {% set axesToHome = axesToHome ~ 'Z ' %} {% endif %} {% endif %} {% if isHomed is false %} M117 Homing {axesToHome} RESPOND MSG="Homing {axesToHome}" G28 {axesToHome} {% else %} RESPOND MSG="All requested axes already homed, skipping.." {% endif %} {% endif %}