Skip to content

Instantly share code, notes, and snippets.

@rootiest
Last active February 24, 2023 01:23
Show Gist options
  • Save rootiest/5e0f0989d7d98ba092df9e9e45c27c2d to your computer and use it in GitHub Desktop.
Save rootiest/5e0f0989d7d98ba092df9e9e45c27c2d to your computer and use it in GitHub Desktop.
Reheat nozzle when resuming after an idle_timeout
[idle_timeout]
timeout: 600
gcode:
{% if printer.pause_resume.is_paused %}
# Store previous temperature
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=prev_temp VALUE={printer.extruder.target}
M117 Idle, turning off hotend
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=0
{% else %}
TURN_OFF_HEATERS
M84
{% endif %}
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
PAUSE_BASE
_TOOLHEAD_PARK_PAUSE_CANCEL
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
variable_prev_temp: 0
gcode:
##### read extrude from _TOOLHEAD_PARK_PAUSE_CANCEL macro #####
{% set extrude = printer['gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL'].extrude %}
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
{% if printer.extruder.can_extrude|lower == 'true' %}
M83
G1 E{extrude} F2100
{% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
{% else %}
# Check that a previous temp was stored:
{% if prev_temp > 0 %}
# Restore previous temp
{action_respond_info("Heating extruder..")}
M109 S{prev_temp}
{% else %}
# No previous temp was stored
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% endif %}
# Reset the stored previous temp
{% set prev_temp = 0 %}
RESUME_BASE {get_params}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment