Skip to content

FIX: bg swap hands the heater back to the slicer, swap never restores… - #196

Merged
decay71 merged 1 commit into
mainfrom
fix/bg-heater-intent
Oct 25, 2026
Merged

decay71 merged 1 commit into
mainfrom
fix/bg-heater-intent

Conversation

@decay71

@decay71 decay71 commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Fix for the temperature detour reported in #172 (nozzle wipe at 250 after a background swap), ported from dev.

  • Background swap: the engine no longer switches a head's heater to 0 when its op ends. It hands the heater back to the newest request from the slicer since it took the heater (for example the M109 for the next tool), else to the target it found, else 0. Once the print has ended it is always 0.
  • Swap: a head that arrives at a target below min extrude no longer gets that target back while printing. It gets the last print temperature a swap saw on that head, else the swap temperature. The post-load wipe uses the same value, so it stays at the print temperature instead of jumping to the database load temperature (250 for Generic PLA).

Tests: tests/unit/test_bg_heat_intent.py (observer and claim/release on stubs).

… a 0 target into a print

Background swap (ace_bg_swap.py, ace.py heater intent observer):
the slicer's M109 for the next head could arrive while the background
cold pull held that head's heater; the op then set the target to 0 and
the M109 waited forever. A heater intent observer around
pheaters.set_temperature records every request that is not the engine's
own. When a bg op ends it restores the newest such request since it
took the heater, else the target it found, else 0 (always 0 once the
print has ended).

Swap (ace.py): a head that arrives at a target below min extrude (a
pause, or a bg op that switched it off) no longer gets that target back
at the end of the swap while printing. It gets the last print
temperature a swap saw on that head, else the swap temperature. The
post-load wipe uses the same value, so it no longer jumps to the
database load temperature (250 for Generic PLA) after a bg op.

tests/unit/test_bg_heat_intent.py: the observer and the claim/release
helpers on stubs.
@decay71
decay71 merged commit 63930e3 into main Oct 25, 2026
7 checks passed
@decay71
decay71 deleted the fix/bg-heater-intent branch October 25, 2026 06:04
docx-tech added a commit that referenced this pull request Oct 25, 2026
@docx-tech

docx-tech commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

@decay71 I can confirm that the temperature is no longer spiking to 250C after the IDLE action when a head is picked up, and goes to the last print temperature.

Full BG Swap Blob Issue

I a full bg swap is completed (and its purging in the back) we get the blob in front of the prime tower again.

Blob
klippy (1).log
image

Heat Spike has been resolved
image

@decay71

decay71 commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Thanks for the log, it shows the blob exactly.

Both cases (13:34 and 13:38 UTC) are the same sequence: the bg swap was still in LD_PRIME when the T arrived. Stock parks the old head, lifts the bg head out of the dock (pick extruder 13:34:26.2) and activates its extruder 2.4 s later (13:34:28.6). The engine's interlock only sees that activation, and only between two prime chunks, so it noticed the pick at 13:34:29.8, about 3.5 s after the nozzle had left the dock. In that window the prime kept running (roughly 10-15 mm at 4 mm/s) and the anti-ooze retract never happened, because the abort fired first. The head was carried to the tower with the purge still coming out, which is the blob in your photo. The pick-check wipe and the cushion only come 8 s later at the discard position. It has nothing to do with the heater hand-back; those lines are all correct in your log (standby 70, print 220).

Fix on branch fix/bg-pick-notice (PR follows): ace.py wraps T0-T3 and announces the toolchange to the bg engine BEFORE the stock macro runs, then waits (up to 8 s) for the handover. The engine stops at its next move boundary while the head is still docked: the prime ends cleanly, sets its anti-ooze cushion and records the missing purge, which the arrival pick-check tops up as before. The other polling phases take their existing pick-abort path, just earlier; the bulk retract is untouched. Log tells: toolchange announced during LD_PRIME, prime stopped at N/153 mm for the announced toolchange - cushion set, background op handed over before the toolchange.

For #186 this is the same spot: ACE_BG_WAIT already sits before the T. In LD_GRIP/LD_PRIME it should request the abort and wait for the handover instead of passing through, otherwise the blob stays with the wait feature. The new request_pick_abort(head) in the engine is exactly that call, you can use it from ACE_BG_WAIT once the branches are merged.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants