From 87a06f9c3063bbc0b6967fc7187efaab4e53db03 Mon Sep 17 00:00:00 2001 From: MangaValk Date: Thu, 22 Oct 2026 16:47:11 +0200 Subject: [PATCH] First layer: AFC fault detection less sensitive A large, slow first layer tripped AFC's buffer fault detection ("AFC NOT FEEDING"). _FIRST_LAYER_FAULT_DETECTION ON=1 at the end of PRINT_START sets first_layer_sensitivity (4: pause after 70 mm instead of 30 mm); ON=0 restores the [AFC_buffer] config value. The slicer calls ON=0 at the start of layer 2: {if layer_num == 1}_FIRST_LAYER_FAULT_DETECTION ON=0{endif} _PRINT_CLEANUP calls it too, for prints that end in the first layer. ON=0 only restores what ON=1 changed. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- macros/print/print_start_end.cfg | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cab40c3..7f0eba9 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ everything below, grouped by topic. Comment out what you do not use there. | `blobifier.cfg` | `BLOBIFIER`, `BLOBIFIER_CLEAN`, `BLOBIFIER_PARK`, `BLOBIFIER_SHAKE_BUCKET`, ...: purge bucket and nozzle brush for AFC (Turtleblobifier, heavily modified) | Blobifier hardware, AFC | | `blobifier_hw.cfg` | servo and bucket switch pins | — | | **print/** | | | -| `print_start_end.cfg` | `PRINT_WARMUP`, `PRINT_START`, `PRINT_END` | Beacon, AFC, Blobifier, `HEAT_SOAK`, iHeater, bd_pressure PA macros (bdwidth is no longer enabled while printing) | +| `print_start_end.cfg` | `PRINT_WARMUP`, `PRINT_START`, `PRINT_END`; `_FIRST_LAYER_FAULT_DETECTION`: AFC buffer fault detection less sensitive during the first layer (needs one line in the slicer's layer change G-code, see the macro) | Beacon, AFC, Blobifier, `HEAT_SOAK`, iHeater, bd_pressure PA macros (bdwidth is no longer enabled while printing) | | `pause_resume.cfg` | `PAUSE`, `RESUME`, `CANCEL_PRINT`, `M600` (RESUME also handles a running `HEAT_SOAK`, and after a PAUSE purges 40 mm with `BLOBIFIER_CHECKED` first: a failed check keeps the print paused, `RESUME PURGE=0` skips the purge; CANCEL_PRINT runs the same cleanup as `PRINT_END`) | `heating/heat_soak.cfg`, `leds/`, `blobifier/`, `afc/purge_check.cfg` | | `filament.cfg` | `LOAD_FILAMENT`, `UNLOAD_FILAMENT` | — | | `homing.cfg` | `HOME`: X/Y, then Z always with Beacon contact (also when already homed); `_Z_CHECK`: stops the print when Klipper's Z and the Beacon reading differ (run in `PRINT_START` after the soak) | Beacon | diff --git a/macros/print/print_start_end.cfg b/macros/print/print_start_end.cfg index 6a52a67..fac6f10 100644 --- a/macros/print/print_start_end.cfg +++ b/macros/print/print_start_end.cfg @@ -249,6 +249,10 @@ gcode: # per-reading width compensation made the flow jump between 77 and 119%. # To use it again: SET_BDWIDTH NAME=fila_width_0 COMMAND=ENABLE_WIDTH + # A large, slow first layer can trip AFC's buffer fault detection + # ("AFC NOT FEEDING"); the slicer switches it back at layer 2 + _FIRST_LAYER_FAULT_DETECTION ON=1 + RESPOND MSG="starting" _STATUS STATE=printing @@ -304,6 +308,34 @@ gcode: {% if 'gcode_macro _PURGE_CHECK_CFG' in printer %} SET_GCODE_VARIABLE MACRO=_PURGE_CHECK_CFG VARIABLE=ignore_missing_sensor VALUE=False {% endif %} + _FIRST_LAYER_FAULT_DETECTION ON=0 ; a print that ended during the first layer + +# AFC buffer fault detection (filament_error_sensitivity, 0-10, higher = +# pauses sooner) with its own value during the first layer. +# ON=1 at the end of PRINT_START, ON=0 from the slicer's layer change G-code +# at the start of layer 2 (OrcaSlicer, layer_num counts from 0): +# {if layer_num == 1}_FIRST_LAYER_FAULT_DETECTION ON=0{endif} +# _PRINT_CLEANUP also calls ON=0. The normal value is read from the +# [AFC_buffer] config; ON=0 only restores it if ON=1 changed it. +[gcode_macro _FIRST_LAYER_FAULT_DETECTION] +description: AFC filament fault detection with first_layer_sensitivity during the first layer (ON=1), back to the config value (ON=0) +variable_buffer: "Turtle_1" +variable_first_layer_sensitivity: 4 # 0-10: 0 = off, 4 = pause after 70 mm, 8 = after 30 mm +variable_lowered: False +gcode: + {% set key = "afc_buffer " ~ buffer|lower %} + {% set normal = printer.configfile.settings[key].filament_error_sensitivity|default(0)|float if key in printer.configfile.settings else 0 %} + {% if params.ON|default(1)|int %} + {% if normal > 0 and first_layer_sensitivity|float != normal %} + AFC_SET_ERROR_SENSITIVITY BUFFER={buffer} SENSITIVITY={first_layer_sensitivity} + SET_GCODE_VARIABLE MACRO=_FIRST_LAYER_FAULT_DETECTION VARIABLE=lowered VALUE=True + RESPOND MSG="AFC fault detection {first_layer_sensitivity} for the first layer (normally {normal})" + {% endif %} + {% elif lowered %} + AFC_SET_ERROR_SENSITIVITY BUFFER={buffer} SENSITIVITY={normal} + SET_GCODE_VARIABLE MACRO=_FIRST_LAYER_FAULT_DETECTION VARIABLE=lowered VALUE=False + RESPOND MSG="AFC fault detection back to {normal}" + {% endif %} # Retract/unretract that is remembered across prints and restarts. # Klipper's G10 only retracts once until a G11, and nothing sends G11 here,