# Include servo hardware definition separately to allow for automatic upgrade
[include mmu_eject_buttons_hw.cfg]

###########################################################################
# Optional hardware MMU eject buttons (e.g. QuattroBox)
#
# This is the supplementary macro to support dedicated per-gate eject
# buttons for easy unloading. It is complimentary to the built-in auto
# preload of filament
#
# To configure:
# 1. Add this to your printer.cfg:
#
#   [include mmu/addons/mmu_eject_buttons.cfg]
#

###########################################################################
# Macro to simply call MMU_EJECT for the specified gate
#
# This logic is separated from actual button h/w setup to facilitate upgrades
# and to allow addition of logic (perhaps validation or warning logic)
#
[gcode_macro _MMU_EJECT_BUTTON]
description: Wrapper around ejecting filament via dedicated hardware buttons
gcode:
    {% set gate = params.GATE|default(-1)|int %}
    {% set mmu = printer['mmu'] %}
    {% set current_gate = mmu.gate %}

    # TODO add validation and warning logic
    MMU_EJECT GATE={gate}