Purge check: fail when bd_pressure does not answer, add override

A bd_pressure that does not answer used to be reported as "pressure
skipped" and the purge passed unchecked. It now fails the check, so in
enforce mode the printer pauses (and a resume purge stays paused).
PURGE_CHECK_IGNORE_SENSOR lets purges pass without the sensor until the
print ends; _PRINT_CLEANUP clears it so the next print checks again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-12 21:18:21 +02:00
1 parent 25891640b8
commit 536db5836d
3 files changed
+28 -3

No files matched your search

+24 -2
View File
@@ -32,7 +32,10 @@
[bdwidth_status]
sensor: fila_width_0
# Remove this section if bdpressure_check.py is not installed
# Remove this section if bdpressure_check.py is not installed. With it
# installed, a bd_pressure that does not answer (stock firmware, hung or
# unplugged sensor) fails the check, so in enforce mode every purge pauses;
# PURGE_CHECK_IGNORE_SENSOR lets the current print finish without it.
[bdpressure_check]
sensor: bd_pa
@@ -50,6 +53,7 @@ variable_bdwidth_warmup_ms: 15000
variable_start_counts: 0
variable_start_e: 0.0
variable_last_failed: False # last check failed in enforce mode (read by _RESUME_PURGE_VERIFY)
variable_ignore_missing_sensor: False # set by PURGE_CHECK_IGNORE_SENSOR, cleared at print end
gcode:
[gcode_macro BLOBIFIER_CHECKED]
@@ -144,8 +148,15 @@ gcode:
{% if p.longest_ms < cfg.pressure_min_ms %}
{% set _ = failed.append("no sustained nozzle pressure") %}
{% endif %}
{% elif 'bdpressure_check' in printer %}
{% if cfg.ignore_missing_sensor %}
{% set press = "pressure skipped: bd_pressure not answering (ignored, PURGE_CHECK_IGNORE_SENSOR)" %}
{% else %}
{% set press = "bd_pressure not answering" %}
{% set _ = failed.append("bd_pressure not answering (power-cycle the sensor, or PURGE_CHECK_IGNORE_SENSOR to finish this print without the check)") %}
{% endif %}
{% else %}
{% set press = "pressure skipped (no check firmware)" %}
{% set press = "pressure skipped (no bdpressure_check)" %}
{% endif %}
{% set checked = motion_on or 'bdpressure_check' in printer and printer.bdpressure_check.available %}
{% set verdict = 'FAIL: ' ~ failed|join(', ') if failed else ('OK' if checked else 'NOTHING CHECKED') %}
@@ -156,3 +167,14 @@ gcode:
PAUSE ; no effect while already paused (resume purge): see _RESUME_PURGE_VERIFY
{% endif %}
{% endif %}
[gcode_macro PURGE_CHECK_IGNORE_SENSOR]
description: Let purges pass without bd_pressure until the print ends (ENABLE=0 to undo)
gcode:
{% if params.ENABLE|default(1)|int %}
SET_GCODE_VARIABLE MACRO=_PURGE_CHECK_CFG VARIABLE=ignore_missing_sensor VALUE=True
RESPOND MSG="PURGE_CHECK: an unavailable bd_pressure is ignored until the print ends (purges are not checked for pressure then)"
{% else %}
SET_GCODE_VARIABLE MACRO=_PURGE_CHECK_CFG VARIABLE=ignore_missing_sensor VALUE=False
RESPOND MSG="PURGE_CHECK: an unavailable bd_pressure fails the check again"
{% endif %}
+3
View File
@@ -257,6 +257,9 @@ gcode:
M221 S100
BED_MESH_CLEAR
SET_SKEW CLEAR=1
{% if 'gcode_macro _PURGE_CHECK_CFG' in printer %}
SET_GCODE_VARIABLE MACRO=_PURGE_CHECK_CFG VARIABLE=ignore_missing_sensor VALUE=False
{% endif %}
# Retract/unretract that is remembered across prints and restarts.
# Klipper's G10 only retracts once until a G11, and nothing sends G11 here,