Show errors and warnings on the display (_ERROR, _WARN)

action_raise_error aborts while the macro renders, so an M117 in the same
macro never ran and errors such as the RESUME lane check only reached the
console. messages.cfg adds _ERROR (M117, then raise in a separate macro)
and _WARN (RESPOND TYPE=error + M117); all errors and warnings use them.
PAUSE shows AFC's error as the pause reason; RESUME, CANCEL_PRINT and
PRINT_WARMUP clear the display.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-16 17:41:41 +02:00
1 parent a67e99015f
commit fbdb2d5e1d
11 files changed
+78 -29

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
# 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)}
_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)}