Repository navigation
feat: two-colour AMS jobs, remote filament load; resume confirms RUNNING - #5
Merged
Merged
Conversation
- slice: repeatable --filament/--color and --filament-change-z write a layer-height ToolChange (--load-custom-gcodes, MultiAsSingle), so the AMS swaps from the G-code with no pause. The change is read back from the G-code; a slice without it exits 11 and never reaches the output dir. - preflight/print send: one --slot per filament; per-filament gates run against each filament's own slot; ams_mapping maps each filament to its tray. Single-filament payloads are unchanged. - filament load --slot S --confirm: print.ams_change_filament while paused or idle; exit 0 only once the printer reports S in the toolhead with the change over. - fix: print resume exited 0 while the printer was still paused; it now waits for RUNNING (--wait) and refuses mid-change or with an empty toolhead. - job: per-filament settings via filament_self_index / filament_extruder_variant; filament changes parsed from the G-code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two-colour printing without anyone at the printer, plus a remote colour change at a pause:
slice --filament P1 --color C1 --filament P2 --color C2 --filament-change-z Zwrites the change the way Bambu Studio's layer slider stores it (--load-custom-gcodes, aToolChangeinMultiAsSinglemode), so the G-code carriesM620 S1A/T1/M621 S1Aat that layer and the AMS swaps by itself.slicereads the change back from the G-code and exits 11 without touching the output dir if Studio didn't place it. Studio drops a ToolChange silently when the mode doesn't fit.preflight/print sendtake one--slotper filament. Every per-filament gate runs against that filament's own slot, andams_mappingbecomes e.g.[3, 0].filament load --slot S --confirmswaps the toolhead to another AMS slot over LAN (print.ams_change_filament). It works only while PAUSE or IDLE/FINISH/FAILED (an allowlist). When paused, the toolhead must hold an AMS filament and the slot must hold the same material. It exits 0 only once the printer reports S in the toolhead with the change finished.print resumeused to exit 0 three seconds after the ack even if the printer was still paused. It now waits for RUNNING (--wait, default 30s, must be positive; otherwise exit 14). It refuses during a filament change, and on X1-series printers when the AMS reports an empty toolhead. That's the only placetray_now 255is verified to mean empty.Contract
status.ams_statusfilament_changes/prime_tower/filament_presets, and per-filamentmodel_g/waste_g/nozzle_temp/nozzle_temp_rangeslots/tray_ids, andfilamenton gate rows of multi-filament jobsfilament_changesprint send --dry-run --slot A4on the same file gives a byte-identical MQTT payload and FTPS plan with v0.2.0 and with this branch, and the same gate names and statuses. Only thesingle_filamentdetail text differs.print resumecan now exit 14 (not RUNNING in time) or 9 (mid-change / empty toolhead) where it used to exit 0.Verification
make cipasses (fmt-check, golangci-lint 0 issues, vet,go test -race, build).mainshowsprint resume --confirmexiting 0 with"state_after": "PAUSE".unzip | awk, the only in-print tool change isM620 S1A/T1/M621 S1Aat layer 21 (Z 4.2), plus the endT255. There's no pause. Filament 1 16.98 g (16.02 + 0.97 waste), filament 2 3.06 g (2.89 + 0.18), 44 min 43 s.print send --dry-run --slot A4 --slot A1gives PASS, with one WARN (A4 has no RFID, so its remaining filament is unknown) andams_mapping [3, 0]. With--slot A4alone it exits 9; with the same slot twice it exits 2. Nothing was uploaded or published.ams_mapping [3, 0]), and the Gofilament loaditself. The identical payload was verified on this printer frombambu-op.