Klipper Macros
Setting up and Tutorials here and good place to learn all the macros on github
- uses Jinja templating language
[gcode_macro pause_toggle]
variable_pause_resume_state: None
# pause is 1
gcode:
## Two ways, 1.
# {% set pause_resume_state = pause_resume_state | default('pause', true) %}
# SET_GCODE_VARIABLE MACRO=pause_toggle VARIABLE=pause_resume_state VALUE="'{ pause_resume_state }'"
# 2.
SET_GCODE_VARIABLE MACRO=pause_toggle VARIABLE=pause_resume_state VALUE="'{ pause_resume_state | default('pause', true) }'"
# Check end position to determine safe direction to move
{% if printer['gcode_macro pause_toggle'].pause_resume_state == "pause" %}
RESUME
M117 RESUMING
# Save target temperature to bed_temp variable
SET_GCODE_VARIABLE MACRO=pause_toggle VARIABLE=pause_resume_state VALUE="'resume'"
{% else %}
PAUSE
M117 PAUSING
# Save target temperature to bed_temp variable
SET_GCODE_VARIABLE MACRO=pause_toggle VARIABLE=pause_resume_state VALUE="'pause'"
{% endif %}
Another way of writing
[gcode_macro my_pause_resume]
gcode:
{% if printer.pause_resume.is_paused %}
RESUME
M117 RESUMING
{% else %}
PAUSE
M117 PAUSING
{% endif %}
Logs #
Mon 03/20/2023 #
- 05:05 learning out to write Macros with klipper