####################################################################
# Helper macros
# - MOVE_SPEED
# - ZES
####################################################################

[gcode_macro MOVE_SPEED]
description: move along certain patterns with selected speed
gcode:
  {% set F=params.F|default(3000)|int %}
  {% if printer.idle_timeout.state != "Printing" %}
    {% if "xyz" in printer.toolhead.homed_axes %}
      {action_respond_info("moving with F%d" % F)}
      ; square clockwise
      M117 > square clockwise
      G0 X275 Y275 F{F}
      G0 Y25
      G0 X25
      G0 Y275
      G0 X275
      ; square counter-clockwise
      M117 > square counter-clockwise
      G0 X25
      G0 Y25
      G0 X275
      G0 Y275
      ; diagonal motor a
      M117 > diagonal motor a
      G0 X25 Y25
      G0 X275 Y275
      G0 X25
      ; diagonal motor b
      M117 > diagonal motor b
      G0 X275 Y25
      G0 X25 Y275
      G0 X275 Y275
    {% else %}
      {action_respond_info("Printer not homed")}
    {% endif %}
  {% else %}
    {action_respond_info("Already printing")}
  {% endif %}


[gcode_macro ZES]
description: Z_ENDSTOP_CALIBRATE + extras
gcode:
  {% if printer.idle_timeout.state != "Printing" %}
    G28
    G0 X150 Y150 Z10 F10000
    Z_ENDSTOP_CALIBRATE
    TESTZ Z=-9
  {% else %}
    {action_respond_info("Already printing")}
  {% endif %}