OrcaSlicer icon indicating copy to clipboard operation
OrcaSlicer copied to clipboard

Wipe tower emits `SET_PRESSURE_ADVANCE` at every toolchange despite `enable_pressure_advance = 0`, overwriting U1 Dynamic Flow Calibration

Open mmunchinski opened this issue 3 months ago • 2 comments

Is there an existing issue for this problem?

  • [x] I have searched the existing issues

Snapmaker_Orca Version

2.3.5

Operating System (OS)

Windows

OS Version

Windows 11

Additional system information

No response

Printer

Snapmaker U1

How to reproduce

Steps 1–5 reproduce the bug in the slicer alone and need no printer. Steps 6–8 show the effect on the machine.

  1. Select the Snapmaker U1 (0.4 nozzle) printer preset with 4 filaments (Generic PLA).
  2. Confirm Filament Settings → Enable pressure advance is OFF for all four — this is the default (enable_pressure_advance = 0,0,0,0).
  3. Load any multi-color model that produces toolchanges, with the prime tower enabled (default).
  4. Slice and export G-code.
  5. Search the exported G-code for SET_PRESSURE_ADVANCE:
    grep -c "^SET_PRESSURE_ADVANCE" out.gcode
    
    One is emitted per toolchange, every one ADVANCE=0.0200, despite pressure advance being disabled in every filament profile.

To observe the effect on the printer:

  1. Load 4 spools and run Dynamic Flow Calibration, so each head has its own measured value in ~/printer_data/config/snapmaker/flow_calibrator.json.
  2. Print the sliced file with Extrusion Flow Calibrate unticked.
  3. Query live pressure advance mid-print over Moonraker:
    curl -s "http://<printer-ip>:7125/printer/objects/query?extruder&extruder1&extruder2&extruder3"
    

Actual results

The exported G-code contains one SET_PRESSURE_ADVANCE ADVANCE=0.0200 immediately before every toolchange, even though enable_pressure_advance = 0,0,0,0. In the attached 4color_default.gcode that is 445 commands for 445 toolchanges — exactly one per toolchange, all the same value. A larger model produced 1032 of them.

On the printer, each head drops to 0.02 the first time it is picked up, discarding the value Dynamic Flow Calibration just measured.

Measured mid-print on a 3-color job on the 4-head machine, heads 0/2/3 in use (extruders_used: [true, false, true, true]). Head 1 was never picked up during this job and acts as the control:

head live pressure_advance flow_calibrator.json
extruder 0.02 0.019627
extruder1 (unused this job) 0.025261 0.025261
extruder2 0.02 0.030072
extruder3 0.02 0.023867

Only heads the job actually picked up are affected. The stored calibration on disk is never modified — the overwrite is live-only, which is why it is invisible from the touchscreen and from flow_calibrator.json.

Single-tool prints are unaffected — they contain zero SET_PRESSURE_ADVANCE commands with the same filament profiles.

Expected results

With enable_pressure_advance = 0, the slicer should not emit SET_PRESSURE_ADVANCE at all, and the printer should print using the per-head values from its own Dynamic Flow Calibration.

Project file & Debug log uploads

snapmaker-orca-gcode.zip snapmaker-orca-log.zip

Checklist of files to include

  • [x] Log file
  • [x] Project file

Anything else?

Root cause

src/libslic3r/GCode/WipeTower2.cpp (tag v2.3.5):

// L645 — upstream Klipper branch commented out
WipeTowerWriter2& disable_linear_advance() {
    ...
    else if (m_gcode_flavor == gcfKlipper) {
        // m_gcode += "SET_PRESSURE_ADVANCE ADVANCE=0\n"; // Snapmaker U1
// L659 — replacement that writes a value instead of 0
WipeTowerWriter2& disable_linear_advance_value(float value = 0.0) {
    ...
    else if (m_gcode_flavor == gcfKlipper) {
        m_gcode += "SET_PRESSURE_ADVANCE ADVANCE=" +
                   Slic3r::float_to_string_decimal_point(value, 4) + "\n"; // Snapmaker U1
// L1327
, m_change_pressure(config.enable_change_pressure_when_wiping)
, m_change_pressure_value(config.ramming_pressure_advance_value)

// L1822 — the only gate
if (m_change_pressure) {
    writer.disable_linear_advance_value(m_change_pressure_value);

enable_pressure_advance appears zero times in WipeTower2.cpp. By contrast, every set_pressure_advance() call in GCode.cpp is correctly gated on it (L665, L807, L8447, L8662) — which is why single-tool prints are unaffected and only wipe-tower prints show the problem.

Defaults in PrintConfig.cpp (L5131–5141):

option code default
enable_change_pressure_when_wiping true
ramming_pressure_advance_value 0.0

Bundled presets, resources/profiles/Snapmaker/machine/Snapmaker U1 (*.? nozzle).json — all four nozzle sizes:

  • set "ramming_pressure_advance_value": "0.02"
  • do not set enable_change_pressure_when_wiping, so it inherits true

Note the emission occurs even though these presets also set "enable_filament_ramming": "0".

Neither option exists in current upstream SoftFever/OrcaSlicer, where the Klipper branch of disable_linear_advance() emits ADVANCE=0 unconditionally. Together with the // Snapmaker U1 comments, this suggests the machinery was added specifically to stop the wipe tower from zeroing the U1's pressure advance. It changes the value written from 0 to 0.02, but still writes unconditionally and never restores the previous value.

Impact beyond calibrated setups

Because the constant is a single scalar shared across all four nozzle presets, it is also wrong against the printer's own uncalibrated baseline (snapmaker/filament_parameters.json) for most material/nozzle combinations:

filament @ nozzle firmware baseline emitted error
TPU @ 0.4 0.25 0.02 12.5× low
PLA @ 0.2 0.2 0.02 10× low
PETG (Snapmaker) @ 0.4 0.05 0.02 2.5× low
PLA @ 0.4 0.02 0.02 match
PLA @ 0.6 0.012 0.02 1.7× high
PLA @ 0.8 0.008 0.02 2.5× high
PA-CF @ 0.8 0.001 0.02 20× high

The one combination where it happens to be correct is PLA @ 0.4 mm, which is likely why this survived review. Reproducing it does not require having run a calibration at all.

Suggested fix

Minimal, no code change — in the four Snapmaker U1 (*.? nozzle).json presets:

"enable_change_pressure_when_wiping": "0"

This sits three lines from the existing ramming_pressure_advance_value override.

More robust, in addition:

  • gate disable_linear_advance_value() on enable_pressure_advance, and/or
  • restore the previous pressure advance after ramming instead of leaving the ramming value in effect for the remainder of the print.

Verification

Three attached slices of the same model, all with enable_pressure_advance = 0,0,0,0 and the stock 0.20 Standard @Snapmaker U1 (0.4 nozzle) / Snapmaker U1 (0.4 nozzle) presets:

file filaments prime tower enable_change_pressure_when_wiping toolchanges SET_PRESSURE_ADVANCE
4color_default.gcode 4 on 1 (default) 445 445
4color_ecpww_off.gcode 4 on 0 445 0
1color_default.gcode 1 off 1 (default) 0 0

The first two differ by exactly one setting, unticked in the UI but not saved as a preset — confirmed by Orca's own record of deviations from the system preset:

$ diff <(grep -E '^; [a-z_0-9]+ = ' 4color_default.gcode   | sort) \
       <(grep -E '^; [a-z_0-9]+ = ' 4color_ecpww_off.gcode | sort)
> ; different_settings_to_system = ;;;;;enable_change_pressure_when_wiping
< ; enable_change_pressure_when_wiping = 1
> ; enable_change_pressure_when_wiping = 0

Nothing else in 562 settings changed, and the toolchange count and prime tower are identical.

The third file is the control: the bug setting is still at its default 1, yet a print with no wipe tower emits nothing. Had enable_pressure_advance been enabled anywhere, GCode.cpp:8662 would have emitted at least one command here.

On the printer, with the setting off and Dynamic Flow Calibration not run for the job, all four heads hold their calibrated values — live pressure_advance of 0.018555 / 0.023893 / 0.024683 / 0.029012 matching flow_calibrator.json exactly, sustained through 253 toolchanges over 7.3 hours of a 4-color print and still holding. Before the change, each head dropped to 0.02 at its first pickup.

For reference, those four values span a 56% range across four spools of nominally identical Generic PLA. Replacing them with 0.02 gives per-head errors of +7.8%, −16.3%, −19.0% and −31.1% — in opposing directions within a single print — against a measured run-to-run repeatability of roughly 3–6% on the same spool.

Why this is hard to notice

The overwrite is live-only. flow_calibrator.json is never modified, the touchscreen keeps showing the calibrated values, and the firmware re-applies them from disk at the start of every print. Every diagnostic path shows a healthy calibration; the divergence is visible only by querying live pressure_advance over Moonraker while a multi-tool print is running.

Ticking Extrusion Flow Calibrate for a job also masks it completely — the firmware rejects G-code pressure advance changes while a calibration job is active (flow calibration enabled, so not take effect.). So the problem only appears on jobs printed without calibration, which is exactly when users expect their stored calibration to be in use.

mmunchinski avatar Aug 13 '26 17:08 mmunchinski

Thanks ! We will fix it in the future version. @mmunchinski

fire2wind avatar Sep 28 '26 03:09 fire2wind

Confirming this is fixed in Snorca 2.4.1 — thanks @fire2wind.

Slice test (U1 0.4, 0.20mm Standard, Snapmaker PLA Basic @U1 / Generic PLA, enable_pressure_advance = 0, two-colour model with prime tower):

SET_PRESSURE_ADVANCE on mid-print toolchanges
2.4.0 101× ADVANCE=0.0200 (every unload)
2.4.1 none

Same result with stock profiles and my own presets.

Real print: 106-minute two-colour print on U1 fw 2.1.0 with dynamic flow calibration on. I polled each head's live pressure_advance against flow_calibrator.json the whole time, and it never deviated at any tool change.

Two small notes for whoever touches this next, neither blocking:

  1. 2.4.1 still emits one SET_PRESSURE_ADVANCE ADVANCE=0 on the final unload, right before PRINT_END, via the legacy toolchange_Unload() → disable_linear_advance() path. It's harmless: nothing extrudes after it, the firmware ignores it when flow calibration is enabled, and otherwise PRINT_START re-applies the stored values on the next job. It's just a leftover that could be removed.
  2. enable_change_pressure_when_wiping and ramming_pressure_advance_value are still shown in the printer settings, but the new generate_new() / toolchange_unload_new() path doesn't read them, so they no longer do anything.

Closing as fixed.

mmunchinski avatar Nov 08 '26 01:11 mmunchinski