How do I stop the end print macro from clearing the homing state/turning off the motors?

The end macro always turns off the motors, can't find a setting to stop it doing that. Is there one?
Solution
[gcode_macro END_PRINT]
description: End print procedure, use this in your Slicer.
gcode:
    # reset is_printing_gcode state
    SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=is_printing_gcode VALUE=False

    # Save gcode state
    SAVE_GCODE_STATE NAME=end_print_state
    {% if printer["dual_carriage"] is defined %}
        # reset swapped toolheads mode
        SET_GCODE_VARIABLE MACRO=_IDEX_REMAP_TOOLHEADS VARIABLE=enabled VALUE=False
        # reset spool join mode
        SET_GCODE_VARIABLE MACRO=_IDEX_JOIN_SPOOLS VARIABLE=enabled VALUE=False
        # reset object xoffset
        {% if printer["gcode_macro RatOS"].auto_center_subject|default(false)|lower == 'true' %}
            {% set object_xoffset = printer["gcode_macro START_PRINT"].object_xoffset|default(0)|float %}
            RATOS_ECHO MSG="Adjusting object x-offset by {(0-object_xoffset)} mm"
            SET_GCODE_OFFSET X_ADJUST={(0-object_xoffset)}
        {% endif %}
    {% endif %}

    # run end print macros
    _USER_END_PRINT_BEFORE_HEATERS_OFF { rawparams }
    _END_PRINT_BEFORE_HEATERS_OFF
    TURN_OFF_HEATERS
    _USER_END_PRINT_AFTER_HEATERS_OFF { rawparams }
    _END_PRINT_AFTER_HEATERS_OFF
    _USER_END_PRINT_PARK { rawparams }
    _END_PRINT_PARK

    # Clear skew profile if any was loaded.
    {% if printer["gcode_macro RatOS"].skew_profile is defined %}
        SET_SKEW CLEAR=1
    {% endif %}

    # turn motors off for non idex printers
    {% if printer["dual_carriage"] is not defined and printer["gcode_macro RatOS"].end_print_motors_off|lower != 'false' %}
        # DEFAULT
        M84
    {% endif %}

    # Part cooling fan off
    M107

    # Clear bed mesh so that G28 doesn't fail.
    BED_MESH_CLEAR
    RATOS_ECHO MSG="Done :)"

    # restore gcode state
    RESTORE_GCODE_STATE NAME=end_print_state

    # turn motors off for idex printers
    {% if printer["dual_carriage"] is defined %}
        # IDEX
        # for the IDEX we must do this after RESTORE_GCODE_STATE
        M84
    {% endif %}

    # reset nozzle thermal expansion offset
    {% if printer.configfile.settings.beacon is defined %}
        {% if printer["dual_carriage"] is not defined %}
            # beacon config
            {% set beacon_contact_start_print_true_zero = true if printer["gcode_macro RatOS"].beacon_contact_start_print_true_zero|default(false)|lower == 'true' else false %}
            {% set beacon_contact_expansion_compensation = true if printer["gcode_macro RatOS"].beacon_contact_expansion_compensation|default(false)|lower == 'true' else false %}
            {% if beacon_contact_start_print_true_zero and beacon_contact_expansion_compensation %}
                SET_GCODE_OFFSET Z=0 MOVE=0
            {% endif %}
        {% endif %}
        _BEACON_SET_NOZZLE_TEMP_OFFSET RESET=True
    {% endif %}

    # restore toolhead settings
    RESTORE_TOOLHEAD_SETTINGS KEY="start_print"

    # chamber filter control
    _CHAMBER_FILTER_ON AT="print_end"
    _CHAMBER_FILTER_OFF

    # chamber heater control
    _CHAMBER_HEATER_OFF

    _USER_END_PRINT_FINISHED { rawparams }
Was this page helpful?