Skip to content

Give the KAOS bridge the same E-mode treatment, and keep it current - #124

Merged
solutionphil merged 1 commit into
alphafrom
kaos-bridge-emode
Sep 4, 2026
Merged

solutionphil merged 1 commit into
alphafrom
kaos-bridge-emode

Conversation

@solutionphil

Copy link
Copy Markdown
Owner

Verifying the alpha update on the dev printer turned up something the AddOn.cfg fix cannot reach: KAOS declares [gcode_macro PHROZEN_TOOLCHANGE] a second time in kaos-ams-bridge.cfg, and a later declaration wins per option. So with KAOS on, the macro that actually runs is that one — and it had the defect twice over.

The AMS branch was worse than the kit's

Its own comment says M83 goes first to close "the kit's standing G1 E-1 before M83 latent defect on this path". It does — but it never hands the mode back. A slicer running absolute E would have every extrusion after the first tool change reinterpreted as relative, for the rest of the print. That is a bigger fault than the one it fixes.

Confirmed by grep: exactly one M83 in the whole bridge, and nothing anywhere restores the mode — not ORCA_PURGE, not PRZ_SPITTING_END.

The no-AMS branch still had the original defect

Its comment says why: "byte-identical to stock". It was, when written. The kit has since fixed that line, so the copy was stale and the claim no longer true.

Both branches now read the mode once at the top and hand it back. Rendered against Klipper's own jinja2, all four combinations:

ams mode on entry renders
1 M82 M83 → retract → M82
1 M83 M83 → retract
0 M82 M83 → retract → M82
0 M83 M83 → retract

It had to survive KAOS_ON / KAOS_OFF

Our bridge configs are copied into printer_data/config when KAOS is activated and never again. $SELF_DIR/config is inside the kit clone, so a kit update refreshes the source and leaves the copies — a printer that has had KAOS on since before an update keeps running the old ones. The same "the correction never reaches the printer" shape as the rest of this week.

So kaos-guard.sh, which already reconciles the spit patch before every klipper start, now refreshes our bridge configs too — keyed on the include line actually present in printer.cfg, exactly like sync_spit_patch. A file whose include is gone is never put back, so KAOS_OFF stays off. KAOS's own files come from the upstream cache and are untouched.

Measured against a copy of the dev printer's config with an isolated KAOS_HOME:

Case Result
include present, bridge stale refreshed, and says so
second run silent
include removed, file deleted not put back
KAOS off the AddOn.cfg macro runs — already current through #@REVISE

Verifying the alpha update on the dev printer turned up something the AddOn.cfg
fix cannot reach: KAOS declares [gcode_macro PHROZEN_TOOLCHANGE] a second time
in kaos-ams-bridge.cfg, and a later declaration wins per option. So on a printer
with KAOS on, the macro that actually runs is this one -- and it had the defect
twice over.

The AMS branch was WORSE than the kit's. Its own comment says M83 goes first to
close "the kit's standing G1 E-1 before M83 latent defect on this path", and it
does -- but it never hands the mode back. A slicer running absolute E would have
every extrusion after the first tool change reinterpreted as relative, for the
rest of the print. That is a bigger fault than the one it fixes. Confirmed by
grep: exactly one M83 in the whole bridge and nothing anywhere that restores the
mode -- not ORCA_PURGE, not PRZ_SPITTING_END.

The no-AMS branch had the original defect untouched, and its comment says why:
"byte-identical to stock". It was, when it was written. The kit has since fixed
that line, so the copy was stale and the claim no longer true.

Both branches now read the mode once at the top and hand it back, the same shape
as the kit macro. Rendered against Klipper's own jinja2 in all four combinations
of ams and entry mode: absolute gives M83 then the retract then M82, relative
gives M83 and the retract, and the retract is present in every case.

AND IT HAD TO SURVIVE KAOS_ON / KAOS_OFF. Our bridge configs are copied into
printer_data/config when KAOS is ACTIVATED and never again. $SELF_DIR/config is
inside the kit clone, so a kit update refreshes the source and leaves the copies
-- a printer that has had KAOS on since before an update keeps running the old
ones. The same "the correction never reaches the printer" shape as the rest of
this week.

So the guard, which already reconciles the spit patch on every klipper start,
now refreshes our bridge configs too. Keyed on the include line actually present
in printer.cfg, exactly like sync_spit_patch: a file whose include is gone is
never put back, so KAOS_OFF stays off. KAOS's own files come from the upstream
cache and are not touched.

Measured against a copy of the dev printer's config with an isolated KAOS_HOME:
with the include present and the installed bridge stale it is refreshed and says
so; a second run is silent; with the include removed and the file deleted,
nothing is put back. With KAOS off the AddOn.cfg macro runs, and that one is
already current through #@reViSe.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@solutionphil
solutionphil merged commit 40b4d8b into alpha Sep 4, 2026
5 checks passed
@solutionphil
solutionphil deleted the kaos-bridge-emode branch September 4, 2026 09:28
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.

1 participant