PA calibration: wider PA range for TPU/TPE
PA_CALIBRATE takes PA_STEP (default 0.002, 0-0.098 over 50 lines). _PA_CFG.material_pa_step uses 0.004 (0-0.196) for tpu/tpe/flex; soft TPU measured 0.094, close to the old end. The "no result" rejection uses the end of the range actually tested. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8a5f6b6dd9
commit
29604b2f1e
3 files changed
+26
-10
No files matched your search
@@ -203,12 +203,17 @@ variable_write_threshold: 0.002
|
||||
# A calibration is rejected (nothing cached or written to Spoolman, the
|
||||
# previous PA is kept) when:
|
||||
# - its result is the last PA_CALIBRATE test value: bdpressure.py found no
|
||||
# result and left the extruder at the end of its scan (0..49 x 0.002),
|
||||
# result and left the extruder at the end of its scan (0..49 x the PA
|
||||
# step: 0.098 at the default step, 0.196 for flexibles),
|
||||
# - the printer paused during the test (e.g. an AFC filament fault),
|
||||
# - bd_pressure gave fewer than min_points readings or fewer than
|
||||
# min_distinct different ones (sensor silent or hung; needs
|
||||
# bdpressure_check.py, otherwise this check is skipped).
|
||||
variable_sweep_end_pa: 0.098
|
||||
variable_pa_step: 0.002 # PA_CALIBRATE tests 50 values: 0..49 x step
|
||||
# Wider range for materials whose PA can be above 0.098 (soft TPU measured
|
||||
# 0.094): same 50 lines and test time, coarser steps. Key contained in the
|
||||
# lane's material (any case); with several matches the largest step wins.
|
||||
variable_material_pa_step: {"tpu": 0.004, "tpe": 0.004, "flex": 0.004}
|
||||
variable_min_points: 10
|
||||
variable_min_distinct: 8
|
||||
# PA applied when a rejected lane has no earlier cached value
|
||||
@@ -464,7 +469,14 @@ gcode:
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{action_respond_info("Calibrating PA for %s (spool %d) at %.0fC, %g mm3/s..." % (lane, spool_id, nozzle_temp, vol.max))}
|
||||
{% set step = namespace(pa=cfg.pa_step|float) %}
|
||||
{% for key, s in cfg.material_pa_step.items() %}
|
||||
{% if key in material and s|float > step.pa %}
|
||||
{% set step.pa = s|float %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{action_respond_info("Calibrating PA for %s (spool %d) at %.0fC, %g mm3/s, PA 0-%.3f..." % (lane, spool_id, nozzle_temp, vol.max, 49 * step.pa))}
|
||||
M117 Calibrating PA: {lane}
|
||||
|
||||
G1 Z50 F3000
|
||||
@@ -473,7 +485,7 @@ gcode:
|
||||
G4 P400
|
||||
G1 Z0 F3000
|
||||
G4 P400
|
||||
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_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}
|
||||
|
||||
# IMPORTANT: we do NOT read printer.extruder.pressure_advance
|
||||
# here. Klipper fully evaluates a macro's Jinja2 template
|
||||
@@ -493,7 +505,7 @@ gcode:
|
||||
# triggered (and its own template is rendered), PA_CALIBRATE
|
||||
# above has already finished and printer.extruder.pressure_advance
|
||||
# is current.
|
||||
_PA_AFTER_CALIBRATE LANE={lane} SPOOL_ID={spool_id} CACHE_FOUND={1 if cache_found else 0} CACHED_PA={cached_pa}
|
||||
_PA_AFTER_CALIBRATE LANE={lane} SPOOL_ID={spool_id} CACHE_FOUND={1 if cache_found else 0} CACHED_PA={cached_pa} SWEEP_END={49 * step.pa}
|
||||
BLOBIFIER_CLEAN
|
||||
G4 P400
|
||||
G1 Z10 F3000
|
||||
@@ -504,13 +516,14 @@ gcode:
|
||||
|
||||
[gcode_macro _PA_AFTER_CALIBRATE]
|
||||
description: Internal -- runs immediately after PA_CALIBRATE completes; reads the fresh PA value and caches it
|
||||
# LANE=<lane_name> SPOOL_ID=<int> CACHE_FOUND=<0|1> CACHED_PA=<float>
|
||||
# LANE=<lane_name> SPOOL_ID=<int> CACHE_FOUND=<0|1> CACHED_PA=<float> SWEEP_END=<last PA tested>
|
||||
gcode:
|
||||
{% set lane = params.LANE|default("")|string %}
|
||||
{% set spool_id = params.SPOOL_ID|default(0)|int %}
|
||||
{% set cache_found = params.CACHE_FOUND|default(0)|int %}
|
||||
{% set cached_pa = params.CACHED_PA|default(0.0)|float %}
|
||||
{% set cfg = printer["gcode_macro _PA_CFG"] %}
|
||||
{% set sweep_end = params.SWEEP_END|default(49 * cfg.pa_step|float)|float %}
|
||||
|
||||
# This template is evaluated only once this macro is actually
|
||||
# triggered -- which happens after PA_CALIBRATE (queued earlier by
|
||||
@@ -519,7 +532,7 @@ gcode:
|
||||
|
||||
# Reject runs where the sensor or the printer had a problem
|
||||
{% set problems = [] %}
|
||||
{% if new_pa >= cfg.sweep_end_pa|float - 0.0001 %}
|
||||
{% if new_pa >= sweep_end - 0.0001 %}
|
||||
{% set _ = problems.append("no result (PA left at the end of the test range, %.3f)" % new_pa) %}
|
||||
{% endif %}
|
||||
{% if printer.pause_resume.is_paused %}
|
||||
@@ -538,7 +551,7 @@ gcode:
|
||||
|
||||
{% if problems %}
|
||||
# A cached value at the end of the scan is an earlier failed run, not a PA
|
||||
{% set use_cache = cache_found and cached_pa < cfg.sweep_end_pa|float - 0.0001 %}
|
||||
{% set use_cache = cache_found and cached_pa < sweep_end - 0.0001 %}
|
||||
{% set keep = cached_pa if use_cache else cfg.fallback_pa|float %}
|
||||
_WARN MSG="PA calibration for {lane} (spool {spool_id}) rejected: {problems|join('; ')}. Nothing saved; using PA={'%.4f' % keep} ({'cached' if use_cache else 'fallback'}). Fix the cause, then LANE_CALIBRATE_PA LANE={lane} FORCE=1" DISPLAY="PA cal rejected: {lane}, see console"
|
||||
SET_PRESSURE_ADVANCE ADVANCE={keep}
|
||||
|
||||
@@ -131,7 +131,10 @@ gcode:
|
||||
G4 P1000
|
||||
{% set y_step = 38.75 %}
|
||||
{% set pressure_ad = 0 %}
|
||||
{% set pressure_step = 0.002 %}
|
||||
# PA_STEP: PA increase per test line, 50 lines (0..49 x step); the
|
||||
# vendor value 0.002 tests 0-0.098. bdpressure.py reports the VALUE
|
||||
# sent with each reading, so a larger step widens the range.
|
||||
{% set pressure_step = params.PA_STEP|default(0.002)|float %}
|
||||
|
||||
G1 F{high_speed}
|
||||
G1 X78 Y{y_step} E9.92204
|
||||
|
||||
Reference in new issue
Block a user