Macros

This will document the behavior of the various Macros provided by Guppy Screen.

guppy_cmd

Guppy Screen provides a few Macros to assist input shaping, produce shaper images, and a few other goodies.

GUPPY_SHAPER

The GUPPY_SHAPER macro runs the input shaping on X/Y and plots the shaper graphs. Note this macro relies on the gcode shell command klippy module since it triggers a custom shaper script instead of the original one provided by Klipper. The custom shaper script adds support for customizing output graph height and weight.

GUPPY_SHAPER
[gcode_macro GUPPY_SHAPERS]
description: Shaper Tuning + Plot Generation
gcode:
  {% set x_png = params.X_PNG|default("/usr/data/printer_data/config/resonances_x.png") %}
  {% set y_png = params.Y_PNG|default("/usr/data/printer_data/config/resonances_y.png") %}

  RESPOND TYPE=command MSG='Homing'
  G28
  RESPOND TYPE=command MSG='Testing X Resonances'
  TEST_RESONANCES AXIS=X NAME=x
  M400
  RESPOND TYPE=command MSG='Generating X Plots'
  RUN_SHELL_COMMAND CMD=guppy_input_shaper PARAMS="/tmp/resonances_x_x.csv -o {x_png}"
  RESPOND TYPE=command MSG='Testing X Resonances'
  TEST_RESONANCES AXIS=Y NAME=y
  M400
  RESPOND TYPE=command MSG='Generating Y Plots'
  RUN_SHELL_COMMAND CMD=guppy_input_shaper PARAMS="/tmp/resonances_y_y.csv -o {y_png}"

GUPPY_BELTS_SHAPER_CALIBRATION

The GUPPY_BELTS_SHAPER_CALIBRATION macro runs the belt shaping routine and plots the graph. Note this macro relies on the gcode shell command klippy module since it triggers a custom version of the Klippain script.

GUPPY_BELTS_SHAPER_CALIBRATION
[gcode_macro GUPPY_BELTS_SHAPER_CALIBRATION]
description: Perform a custom half-axis test to analyze and compare the frequency profiles of individual belts on CoreXY printers
gcode:
  {% set min_freq = params.FREQ_START|default(5)|float %}
  {% set max_freq = params.FREQ_END|default(133.33)|float %}
  {% set hz_per_sec = params.HZ_PER_SEC|default(1)|float %}
  {% set png_out_path = params.PNG_OUT_PATH|default("/usr/data/printer_data/config/belts_calibration.png") %}
  {% set png_width = params.PNG_WIDTH|default(8)|float %}
  {% set png_height = params.PNG_HEIGHT|default(4.8)|float %}

  TEST_RESONANCES AXIS=1,1 OUTPUT=raw_data NAME=b FREQ_START={min_freq} FREQ_END={max_freq} HZ_PER_SEC={hz_per_sec}
  M400

  TEST_RESONANCES AXIS=1,-1 OUTPUT=raw_data NAME=a FREQ_START={min_freq} FREQ_END={max_freq} HZ_PER_SEC={hz_per_sec}
  M400

  RESPOND MSG="Belts comparative frequency profile generation..."
  RESPOND MSG="This may take some time (3-5min)"
  RUN_SHELL_COMMAND CMD=guppy_belts_calibration PARAMS="-w {png_width} -l {png_height} -n -o {png_out_path} -k /usr/share/klipper /tmp/raw_data_axis=1.000,-1.000_a.csv /tmp/raw_data_axis=1.000,1.000_b.csv"

_GUPPY_LOAD_MATERIAL

The _GUPPY_LOAD_MATERIAL macro runs the load filament route. It’s mapped to the Load button in the UI.

_GUPPY_LOAD_MATERIAL
[gcode_macro _GUPPY_LOAD_MATERIAL]
gcode:
  {% set extruder_temp = params.EXTRUDER_TEMP|default(240)|int %}
  {% set extrude_len = params.EXTRUDE_LEN|default(35)|int %}
  LOAD_MATERIAL_CLOSE_FAN2
  M109 S{extruder_temp}
  G91
  G1 E{extrude_len} F180
  LOAD_MATERIAL_RESTORE_FAN2 # k1 stuff

_GUPPY_QUIT_MATERIAL

The _GUPPY_QUIT_MATERIAL macro runs the unload filamanet routine. This is mappped to the Unload button in the UI.

_GUPPY_QUIT_MATERIAL
[gcode_macro _GUPPY_QUIT_MATERIAL]
gcode:
  {% set extruder_temp = params.EXTRUDER_TEMP|default(240)|int %}
  SAVE_GCODE_STATE NAME=myMoveState
  M109 S{extruder_temp}
  G91
  G1 E20 F180
  G1 E-30 F180
  G1 E-50 F2000
  RESTORE_GCODE_STATE NAME=myMoveState

GUPPY_K1_SSH_RESTART

The GUPPY_K1_SSH_RESTART macro runs tries to restart dropbear, the SSHd service in the K1 variant. If you ever lose SSH access but still have access to Moonraker (e.g. working fluidd/mainsail), try this running this macro to restore SSH acccess.

GUPPY_K1_SSH_RESTART
[gcode_shell_command GUPPY_K1_SSH_RESTART]
command: /etc/init.d/S50dropbear
timeout: 600.0
verbose: True