From cd1cd7ca47a1a0b79f836b0b01c233428283b827 Mon Sep 17 00:00:00 2001 From: MangaValk Date: Sat, 7 Nov 2026 16:44:47 +0100 Subject: [PATCH] PA test: AFC buffer fault detection at 2 during PA_CALIBRATE At the configured 8 the buffer faults after 30 mm in one state; during the test lines it needs far more to reach its other sensor, so every lane1 calibration on 2026-11-07 paused with AFC NOT FEEDING. With detection off the buffer switched after ~80 s and the test finished. _PA_CFG.test_error_sensitivity (2) is set before PA_CALIBRATE and the [AFC_buffer] config value is restored after it through _FIRST_LAYER_FAULT_DETECTION ON=0 (lowered=True), which _PRINT_CLEANUP also calls when the test stops with an error. Nothing changes when detection is off in the config. Co-Authored-By: Claude Opus 5.5 --- macros/pressure_advance/bd_pa_spoolman.cfg | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/macros/pressure_advance/bd_pa_spoolman.cfg b/macros/pressure_advance/bd_pa_spoolman.cfg index 2edf2bb..8272397 100644 --- a/macros/pressure_advance/bd_pa_spoolman.cfg +++ b/macros/pressure_advance/bd_pa_spoolman.cfg @@ -208,6 +208,13 @@ variable_material_max_volumetric: {"tpu": 8, "tpe": 8, "flex": 8} # Nozzle height (mm) for the test lines (PA_CALIBRATE keeps the current Z). # At 5 they are extruded in the air, clear of the bed and plate. variable_test_z: 5 +# AFC buffer fault detection during the test lines (0-10, 0 = off). At the +# normal 8 the buffer faults after 30 mm in one state, and during the test it +# needs far more to reach its other sensor (2026-11-07: ~80 s for the first +# change), so every test paused with AFC NOT FEEDING. 2 still catches a lane +# that stops feeding. Restored to the [AFC_buffer] config value after +# PA_CALIBRATE, or by _PRINT_CLEANUP if the test stops with an error. +variable_test_error_sensitivity: 2 variable_acc_wall: 5000 variable_travel_speed: 300 variable_acc_to_decel_factor: 50 @@ -481,7 +488,21 @@ gcode: G4 P400 G1 Z{cfg.test_z} F3000 G4 P400 + # Buffer fault detection for the test (see test_error_sensitivity). + # lowered=True lets _FIRST_LAYER_FAULT_DETECTION ON=0 restore it, + # here and in _PRINT_CLEANUP when the test stops with an error. + {% set fl = printer["gcode_macro _FIRST_LAYER_FAULT_DETECTION"] %} + {% set buf_key = "afc_buffer " ~ fl.buffer|lower %} + {% set normal_sens = printer.configfile.settings[buf_key].filament_error_sensitivity|default(0)|float if buf_key in printer.configfile.settings else 0 %} + {% set lower_sens = normal_sens > 0 and cfg.test_error_sensitivity|float != normal_sens %} + {% if lower_sens %} + AFC_SET_ERROR_SENSITIVITY BUFFER={fl.buffer} SENSITIVITY={cfg.test_error_sensitivity} + SET_GCODE_VARIABLE MACRO=_FIRST_LAYER_FAULT_DETECTION VARIABLE=lowered VALUE=True + {% endif %} PA_CALIBRATE NOZZLE_TEMP={nozzle_temp} MAX_VOLUMETRIC={vol.max} ACC_WALL={cfg.acc_wall} TRAVEL_SPEED={cfg.travel_speed} ACC_TO_DECEL_FACTOR={cfg.acc_to_decel_factor} PA_STEP={step.pa} + {% if lower_sens %} + _FIRST_LAYER_FAULT_DETECTION ON=0 + {% endif %} # IMPORTANT: we do NOT read printer.extruder.pressure_advance # here. Klipper fully evaluates a macro's Jinja2 template