Viesturz / klipper-toolchanger

Basic Information:

Printer Model: self built
MCU / Printerboard: Octopus Pro
Host / SBC
klippy.log
20250508-215910.zip (5.3 KB)

My printer is equipped with a toolchanger and two independent toolheads.
Each toolhead can be automatically picked up or dropped off at one of two docking stations, which are mounted on a liftbar mechanism.

The docking stations use a rotating stepper motor to mechanically lock or release their respective toolhead during tool changes.

I’m using the Viesturz toolchanger configuration, but the rotating stepper mechanism that locks and releases the toolhead at the docking station is not yet implemented in the current pickup.gcode and dropoff.gcode macros of the toolchanger.cfg. I need to create this functionality and integrate it into the existing toolchanger.cfg.

  • Unlocking the toolhead before pickup
  • Locking the toolhead after pickup

pickup_gcode:
{% set x = tool.params_park_x|float %}
{% set y = tool.params_park_y|float %}
{% set liftbar_z = tool.params_park_liftbar_z|float %}
{% set fast = tool.params_fast_speed|float %}
{% set slow = tool.params_path_speed|float %}
{% set path = tool.params_pickup_path %}
RESPOND TYPE=echo MSG=‘Picking up {tool.name}’
G90
# ############## Fast to the last point ##############
ROUNDED_G0 Y={tool.params_close_y} F={fast} D=5
ROUNDED_G0 X={x} F={fast} D=0
LIFTBAR_MOVE Z={ liftbar_z - path[0][‘z’]|float}
ROUNDED_G0 Y={y + path[0][‘y’]|float} F={fast} D=0

Here I tried to implement my gcode “Unlocking the toolhead before pickup”:
(but it does not work)

{% set tc_macro = "CLOSE_TC" + (tool.tool_number|string) %}
{% if printer["gcode_macro " + tc_macro] is defined %}
    RUN_MACRO MACRO={tc_macro}
{% else %}
    RESPOND MSG="Makro {tc_macro} nicht definiert."
{% endif %}

# Wait for temp before actually picking up the tool, while the nozzle is resting on it's pad.
{% if tool.extruder %}
  SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={printer[tool.extruder].target}
  TEMPERATURE_WAIT SENSOR={printer.toolhead.extruder} MINIMUM={printer[tool.extruder].target}
{% endif %}
# Run the path
{% for pos in path %}
  {% set speed = tool.params_path_speed|float * (pos.get('f', 1.0)|float) %}
  {% if 'z' in pos %}
      LIFTBAR_MOVE Z={liftbar_z - pos['z']|float} F={speed} SYNC=0
  {% endif %}
  {% if 'x' in pos or 'y' in pos %}
      G0 {% if 'x' in pos %}X{x + pos['x']|float}{% endif %} {% if 'y' in pos %}Y{y + pos['y']|float}{% endif %} F{speed}
  {% endif %}
  LIFTBAR_MOVE SYNC=1
  {% if 'verify' in pos %}
    VERIFY_TOOL_DETECTED T={tool.tool_number}
  {% endif %}
{% endfor %}

#Here I tried to implement my gcode “Locking the toolhead after pickup”:
(but it does not work)

{% set tc_macro = "OPEN_TC" + (tool.tool_number|string) %}
{% if printer["gcode_macro " + tc_macro] is defined %}
    RUN_MACRO MACRO={tc_macro}
{% else %}
    RESPOND MSG="Makro {tc_macro} nicht definiert."
{% endif %}


G0 Y{tool.params_safe_y} F{slow}
LIFTBAR_PARK_TOP

Does someone know how to write these lines correct?
Thanks, Timo