Printing/resume doesnt work

Basic Information:

Printer Model: E3P fully upgraded
MCU / Printerboard: SKR mini 3v3.0
[x klippy log is too big

{“code”:“key165”, “msg”: "Error evaluating ‘gcode_macro RESUME:gcode’: UndefinedError: ‘instance object’ has no attribute ‘gcode_macro _km_globals’
", “values”: [“gcode_macro RESUME:gcode”, "UndefinedError: ‘instance object’ has no attribute ‘gcode_macro _km_globals’
"]}

[gcode_macro RESUME]
description: Resumes the currently paused print.
Usage: RESUME [E]
rename_existing: _KM_RESUME_BASE
variable_saved_extruder_temp: 0
variable_saved_x: 0.0
variable_saved_y: 0.0
variable_saved_z: 0.0
variable_saved_e: 0.0
gcode:
{% if printer.pause_resume.is_paused %}
{% set km = printer[“gcode_macro _km_globals”] %}
# Warm the extruder back up if needed.
{% set extruder = printer[printer.toolhead.extruder] %}
{% if extruder.target <= printer.configfile.settings[
printer.toolhead.extruder].min_temp
| float + 0.5 %}
M109 S{saved_extruder_temp}
{% endif %}

# If there's no saved_e assume we're completing a filament change and
# retract enough to avoid drooling on the model.
{% if 'E' not in params and not saved_e %}
  {% set saved_e = 5.0 %}
  G1 E{'%.4f' % -saved_e } F{km.load_speed}
{% endif %}

SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_extruder_temp VALUE="{0}"
G90
# Move back to last position before unretracting.
G0 X{saved_x} Y{saved_y} F{km.travel_speed_xy}
G0 Z{saved_z} F{km.travel_speed_z}
G91
# Unretract
G1 E{'%.4f' % (params.E|default(saved_e))} F{km.load_speed}
RESTORE_GCODE_STATE NAME=_KM_PAUSE_OVERRIDE_STATE MOVE=1
_KM_RESUME_BASE

{% else %}
{ action_respond_info(“Printer is not paused.”) }
{% endif %}

[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
variable_park: True
gcode:

Move head and retract only if not already in the pause state and park set to true

{% if printer.pause_resume.is_paused|lower == ‘false’ and park|lower == ‘true’%}
_TOOLHEAD_PARK_PAUSE_CANCEL
{% endif %}
TURN_OFF_HEATERS
CANCEL_PRINT_BASE

[gcode_macro cancel_print]
description: Cancels the current print.
Usage: CANCEL_PRINT
rename_existing: _KM_CANCEL_PRINT_BASE
gcode:
{% set was_paused = printer.pause_resume.is_paused %}
{% if was_paused or printer.idle_timeout.state|string == “Printing” %}
PRINT_END
SDCARD_RESET_FILE
{% else %}
{ action_respond_info(“No print from SD card in progress.”) }
{% endif %}
_KM_CANCEL_PRINT_BASE
{% if was_paused %}
RESTORE_GCODE_STATE NAME=_KM_PAUSE_OVERRIDE_STATE MOVE=0
{% endif %}
CLEAR_PAUSE

[gcode_macro TOOLHEAD_PARK_PAUSE_CANCEL]
description: Helper: park toolhead used in PAUSE and CANCEL_PRINT
variable_extrude: 1.0
gcode:

set park positon for x and y

default is your max posion from your printer.cfg

{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
{% set z_park_delta = 2.0 %}

calculate save lift position

{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z < (max_z - z_park_delta) %}
{% set z_safe = z_park_delta %}
{% else %}
{% set z_safe = max_z - act_z %}
{% 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 %}
{action_respond_info(“Extruder not hot enough”)}
{% endif %}
{% if “xyz” in printer.toolhead.homed_axes %}
G91
G1 Z{z_safe} F900
G90
G1 X{x_park} Y{y_park} F6000
{% if printer.gcode_move.absolute_coordinates|lower == ‘false’ %} G91 {% endif %}
{% else %}
{action_respond_info(“Printer not homed”)}
{% endif %}

[gcode_macro CLEAR_PAUSE]
description: Clears the current pause state.
Usage: CLEAR_PAUSE
rename_existing: _KM_CLEAR_PAUSE
gcode:
SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_e VALUE=“{0.0}”
SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_extruder_temp VALUE=“{0}”
_KM_CLEAR_PAUSE

[gcode_macro PAUSE]
rename_existing: PAUSE_BASE
gcode:
PAUSE_BASE
_TOOLHEAD_PARK_PAUSE_CANCEL

klippy.log (221.3 KB)

Your best bet is to contact Creality support

1 Like

This looks like someone tried to install @jschuh macros but didn’t do it correctly.

Nah, it came from:
But I think I got it working with someone else’s code instead
thanks

I’m pretty certain those _km_globals errors were somehow copied from my macros, but either way glad you got something working.

FWIW, I’ve already gotten reports that my macros break on the Sonic Pad. Turns out the Klipper fork is too old to support SET_PRINT_STATS_INFO.

1 Like

FYI the macros of jschuh are working ok on sonic pad using version 0.5.3 except the layer that is from version 0.4.8 and also need to remove M600 macro else duplicate

if there’s a mailing or a place to request Creality to update Klipper on sonic pad i would be happy to +1