2026-10-16 17:41:41 +02:00
|
|
|
# Errors and warnings that also show on the display (M117: the status line in
|
|
|
|
|
# Mainsail and KlipperScreen, display_status.message)
|
|
|
|
|
#
|
|
|
|
|
# action_raise_error aborts while the macro is rendered, before any of its
|
|
|
|
|
# G-code runs, so an M117 in the same macro never shows. _ERROR sends the
|
|
|
|
|
# M117 first and raises the error in a separate macro: the display keeps the
|
|
|
|
|
# text and the calling macros are aborted as with action_raise_error.
|
|
|
|
|
#
|
|
|
|
|
# _ERROR MSG="full text for the console" DISPLAY="short text"
|
|
|
|
|
# _WARN MSG="full text for the console" DISPLAY="short text"
|
|
|
|
|
#
|
|
|
|
|
# DISPLAY defaults to MSG. No double quotes in either (they end the
|
|
|
|
|
# parameter). Nothing after an _ERROR in the calling macro runs, but
|
|
|
|
|
# anything that macro does while rendering (action_respond_info, ...) has
|
|
|
|
|
# already happened: put the rest in an else branch.
|
|
|
|
|
|
|
|
|
|
[gcode_macro _ERROR]
|
|
|
|
|
description: Show DISPLAY (default MSG) on the display, then raise MSG as an error (aborts the calling macros)
|
|
|
|
|
gcode:
|
|
|
|
|
M117 {params.DISPLAY|default(params.MSG)}
|
2026-10-17 19:32:42 +02:00
|
|
|
{% if 'gcode_macro _STATUS_FLASH' in printer %}
|
|
|
|
|
_STATUS_FLASH STATE=error
|
|
|
|
|
{% endif %}
|
2026-10-16 17:41:41 +02:00
|
|
|
_RAISE_ERROR MSG="{params.MSG}"
|
|
|
|
|
|
|
|
|
|
[gcode_macro _RAISE_ERROR]
|
|
|
|
|
description: Helper for _ERROR: raise MSG as an error
|
|
|
|
|
gcode:
|
|
|
|
|
{action_raise_error(params.MSG)}
|
|
|
|
|
|
|
|
|
|
[gcode_macro _WARN]
|
|
|
|
|
description: Show MSG as an error line in the console and DISPLAY (default MSG) on the display, without stopping
|
|
|
|
|
gcode:
|
|
|
|
|
RESPOND TYPE=error MSG="{params.MSG}"
|
|
|
|
|
M117 {params.DISPLAY|default(params.MSG)}
|