Skip to content

Runout resume wipes the head's measured flow calibration (flow_k) while restoring the same filament's metadata from backup #8

Open

Description

@mmunchinski

Firmware version

1.5.2.13_20260722102206 (installed via official OTA). Code references below are to this repository, branch main (v1.5.2 release)

Firmware source

Official release

Third-party firmware source

N/A

Was the configuration modified?

No

What configuration changes were made?

N/A

Was the source code modified?

No

What source code changes were made?

N/A

How can the issue be reproduced?

  1. Start a print with valid measured flow calibration factors on all heads (in my test:
    extruder2 = 0.023951, measured by the printer's own flow calibration the previous day).
    Do not request flow calibration for this job. Factors can be observed via Moonraker:
    • store: curl "http://PRINTER_IP/server/files/config/snapmaker/flow_calibrator.json"
    • live: curl "http://PRINTER_IP/printer/objects/query?extruder2=pressure_advance"
  2. Mid-print, cut the active head's filament upstream of the feeder and let it run out.
    The printer detects the runout and pauses.
  3. At the runout prompt, feed the same spool back in and press Resume. (Nothing else —
    no filament screen, no unload menu.)
  4. Observe the factor before, during, and after with the two queries above. I polled both
    every 5 seconds through the whole event (attached: pa_store_poll.csv).

What was the actual result?

The head's measured factor is destroyed at the filament-load step — in both the live
pressure_advance and the persisted store — and replaced with the per-class default
(0.02 for PLA). The remainder of the print runs at the default, 16.5% below the measured
value for this head. From the attached 5-second poll (columns: live PA / stored factor for
extruder2):

07:14:48  paused    0.023951 / 0.023951   <- runout pause: detection alone wipes nothing
07:16:02  paused    0.023951 / 0.023951
07:16:07  paused    0.02     / 0.02       <- wiped when filament was fed / resume handling began
07:17:52  printing  0.02     / 0.02       <- rest of print at default (-16.5%)

Additional data points from the same sessions:

  • A pause + resume cycle without a filament load (07:03–07:05, same print) left all
    factors untouched — the load is the trigger, not pause/resume.
  • The touchscreen filament screen path (unload + reload) produces the identical wipe
    (tested the previous day on extruder1: 0.023893 → 0.02).
  • No re-measurement occurs at resume: flow_calculator.log (attached) shows no
    calibration activity during the event.
  • The discarded values are good: re-measuring the wiped head on the next flow-calibrated
    print returned 0.023967 vs 0.023893 before the wipe — 0.3% repeatability on the same
    spool. The 0.02 default is 16–19% off the measured values on my machine.

Where this happens in the code:

  • klippy/extras/print_task_config.py, cmd_INNER_CHECK_AND_RELOAD_FILAMENT_INFO
    (line 824, called from the INNER_RESUME macro): in the
    is_runout and self.filament_info_backup branch, the previous filament's type, vendor,
    sub_type, softness, and colors are restored from backup — i.e. the firmware itself
    models the reload as "same filament, continue" — and then line 857 unconditionally runs
    FLOW_RESET_K EXTRUDER={extruder_index}.
  • klippy/extras/flow_calibrator.py, _reset_pressure_advance() (line 476, the
    FLOW_RESET_K handler): applies the class default from
    filament_parameters.get_flow_k(...) to the extruder and persists it via
    _save_config()
    — so the measured factor is destroyed in
    snapmaker/flow_calibrator.json, not just overridden for the session.
  • The touchscreen load path reaches the same wipe through the sibling FLOW_RESET_K
    call sites at print_task_config.py:365 and :679.

Note this also implies auto_replenish_filament degrades the head to the default on
every automatic replenish (it necessarily loads filament mid-print) — I have not tested
that path yet, but it follows the same code.

What was the expected result?

When the firmware's own runout branch restores the previous filament's metadata from
backup ("same filament, continue"), the measured flow factor should survive with it —
the branch's premise applies to the calibration exactly as much as to the metadata. All
inputs for a safe policy are already available in that function:

  1. Minimum: skip FLOW_RESET_K (or restore the backed-up factor) when the backup
    filament info is being restored.
  2. Better: keep the factor when the reloaded filament matches by RFID tag UID, or by
    declared vendor/type/sub-type when untagged; reset to the class default only for a
    genuinely different filament (current behavior, which is correct for that case).
  3. Optionally: offer a single-head re-measure at resume (~3.5 min). The resume sequence
    already parks at the discard position with the head at temperature, which is where and
    how flow calibration runs anyway.

Log files

  • pa_store_poll.csv — 5-second Moonraker poll across the whole test: print state, live
    pressure_advance for all four heads, and the four stored factors from
    snapmaker/flow_calibrator.json. Covers baseline, a control pause/resume without
    filament load (07:03), the runout pause (07:14:48), the wipe (07:16:07), and the
    resumed print.
  • flow_calculator.log — the flow calibration service's own log, showing measurement
    activity on Aug 12 and Aug 16 and none during the runout/resume event.
  • console_excerpt.txt — Klipper console history for the pause and resume sequences,
    captured live via /server/gcode_store during the event (note: klippy.log on this
    unit has not been written since initial setup day, and the gcode_store ring buffer
    evicts within hours, so this excerpt was captured in real time).

console_excerpt.txt

flow_calculator.log

pa_store_poll.csv

Activity

  1. added
    bug
    on Aug 17, 2026
  2. alandebortolo commented on Nov 7, 2026

    @alandebortolo

    Thanks for the 5-second poll: it is what located the wipe. The factor is already 0.02 at 07:16:07 and Resuming... only comes at 07:16:14, so the first reset happens before the resume handler runs. It is the RFID reader's answer when the switch reads "present" again (_rfid_filament_info_update_cb runs FLOW_RESET_K, and an untagged spool reads as the empty card); for an untagged spool, Resume's INNER_CHECK_AND_RELOAD_FILAMENT_INFO then restores the backed-up filament and resets a second time. _reset_pressure_advance() writes the class default to flow_calibrator.json, which is why 0.02 survived into the next prints.

    Fix in draft PR #27 (your item 1, applied to both calls): while the print is paused, a spool that is untagged or whose tag matches the backed-up vendor/type/sub-type keeps the measured factor; a tag for a different filament still resets, and so does SET_PRINT_FILAMENT_CONFIG from the screen. One file, klippy/extras/print_task_config.py, +13/-2.

    I ran it on the firmware in Klipper batch mode (2.0.0 and 2.1.0), through the real runout, reload and Resume path: stock goes 0.023951 -> 0.02 live and on disk right at the feed, patched keeps 0.023951, and a PETG tag still resets to 0.05 (test and logs). Batch mode has no sensor and no reader, so I could not run it on a printer. If you can run the patched file on your U1, the check is your own poll: runout, feed the same spool back, Resume, and extruder2.pressure_advance plus the stored factor should stay at 0.023951. Either way, please tell me what you see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions