Add a bed check: warn about bumps and flatness, pause PRINT_START on a failure

BED_SCAN_CHECK levels, scans and warns, without heating or touching the bed.
extras/mesh_check.py fits a smooth surface to the mesh and reports areas more
than 0.03 mm from it, and a range over 0.30 mm.

In PRINT_START a failed check pauses before the nozzle heats. Resume sets the
print file back to the PRINT_START line (M26), so it runs again as normal file
G-code. BED_CHECK_IGNORE lets the next failed check only warn.

Tested on saved scans and rendered macros only, not yet on the printer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-06 16:16:36 +01:00
1 parent e540e40cf7
commit 99b7109b5b
7 files changed
+358 -5

No files matched your search

+11 -2
View File
@@ -16,6 +16,9 @@
# (the lane AFC was loading when a tool change failed, otherwise the loaded
# lane), and RESUME stops with an error when another lane (or none) is loaded.
# RESUME LANE_CHECK=0 resumes anyway (e.g. after remapping with SET_MAP).
# A failed bed check in PRINT_START (calibration/bed_scan_check.cfg) pauses with
# _BED_CHECK_STATE.pending set: PAUSE then only pauses, and RESUME runs
# PRINT_START again instead of this chain's purge and lane check.
# https://klipperscreen.readthedocs.io/en/latest/macros/#recommended
[gcode_macro PAUSE]
@@ -25,7 +28,9 @@ variable_saved_fan_speed: 0.0
variable_parked: False # set by PAUSE, used by _RESUME_PRINT
variable_expected_lane: '' # AFC lane the print needs after RESUME ('' = no check)
gcode:
{% if not printer.pause_resume.is_paused %}
{% if printer["gcode_macro _BED_CHECK_STATE"].pending %}
PAUSE_BASE
{% elif not printer.pause_resume.is_paused %}
# AFC sets next_lane during a tool change and still has it when a failed
# change pauses the print; it clears it once CHANGE_TOOL returns
{% if 'AFC' in printer %}
@@ -54,7 +59,11 @@ gcode:
description: Resume the print (while HEAT_SOAK runs: skip the soak phase)
rename_existing: RESUME_BASE
gcode:
HEAT_SOAK_RESUME ON_RESUME=_RESUME_PRINT {rawparams}
{% if printer["gcode_macro _BED_CHECK_STATE"].pending %}
_BED_CHECK_RETRY
{% else %}
HEAT_SOAK_RESUME ON_RESUME=_RESUME_PRINT {rawparams}
{% endif %}
[gcode_macro _RESUME_PRINT]
description: Resume after PAUSE: purge and check (or unretract), restore the part fan, continue the print