Skip to content

fix: AMS slot labels always show 'A' when selecting a non-first AMS unit#10844

Open
BenJule wants to merge 5 commits into
bambulab:masterfrom
BenJule:fix/10512-ams-slot-labels-wrong-unit
Open

fix: AMS slot labels always show 'A' when selecting a non-first AMS unit#10844
BenJule wants to merge 5 commits into
bambulab:masterfrom
BenJule:fix/10512-ams-slot-labels-wrong-unit

Conversation

@BenJule

@BenJule BenJule commented May 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • In the Add Filament → Read from AMS dialog, the slot labels (A1–A4) were hardcoded and never updated when the user switched to a second or third AMS unit.
  • With multi-AMS setups, selecting AMS B would still display slot labels A1, A2, A3, A4 — matching none of the identifiers shown everywhere else in the UI (filament grouping, bound_ams_id field, etc.).
  • Fix: derive the unit letter from currentUnit.ams_id ('0' = A, '1' = B, …) and construct slotLabels dynamically so they always reflect the currently selected AMS unit.

Change

One-line change in AddEditDialog.tsx:

// Before
const slotLabels = ['A1', 'A2', 'A3', 'A4'];

// After
const unitLetter = currentUnit ? String.fromCharCode('A'.charCodeAt(0) + parseInt(currentUnit.ams_id, 10)) : 'A';
const slotLabels = [1, 2, 3, 4].map((n) => `${unitLetter}${n}`);

Test plan

  • Single AMS: slot labels still show A1–A4
  • Two AMS units connected: switching to unit 2 shows B1–B4; switching back shows A1–A4
  • Three+ AMS units: C1–C4 for unit 3, etc.

Fixes #10512

BenJule added 5 commits May 21, 2026 10:52
The upstream build_all.yml only listed 'main' as a push trigger.
BenJule/BambuStudio uses 'master' as its default branch, so CI never
fired on fork-local pushes. Adding 'master' alongside 'main' makes
the full multi-platform build run when master is updated.
When a spool has a note, display it as a third sub-line in the Filament
column, below the colour/diameter info. The note is truncated with an
ellipsis and the full text is available on hover. Rows without a note
are unchanged.

Closes bambulab#10834
…_filament_gcode templates

The expression {retract_length_toolchange[filament_map[next_extruder]-1]}
directly indexes retract_length_toolchange as a vector in the PlaceholderParser.
When this vector is empty (e.g. due to config compatibility issues with
older 3MF project files), the parser throws "Indexing an empty vector
variable" and slicing fails.

Replace with [new_retract_length_toolchange], the pre-computed scalar
already set in GCode.cpp via full_config.retract_length_toolchange.get_at(),
which handles empty/short arrays safely. For all affected profiles the
default value is 2.0 mm across all extruder variants, so the output is
identical.

Affected templates: X2D, P2S, H2D Pro, H2S (0.4 nozzle)

Fixes bambulab#10437
…ected

In the Add Filament / Read from AMS dialog, slotLabels was hardcoded as
['A1','A2','A3','A4'] regardless of which AMS unit was selected. With
multi-AMS setups (two or more AMS units attached to the same printer),
slots on the second unit would display B1–B4 in every other part of the
UI (the filament grouping, the bound_ams_id field, etc.) but the slot
picker inside the dialog always showed A1–A4.

Fix: derive the unit letter from currentUnit.ams_id (which is '0' for
AMS A, '1' for B, etc.) so that slotLabels matches the selected unit.

Fixes bambulab#10512
@BenJule BenJule force-pushed the fix/10512-ams-slot-labels-wrong-unit branch from 3f347c9 to 7c568f1 Compare May 21, 2026 08:55
@BenJule BenJule closed this Jun 7, 2026
@BenJule BenJule deleted the fix/10512-ams-slot-labels-wrong-unit branch June 7, 2026 10:09
@BenJule BenJule reopened this Jun 7, 2026
@BenJule

BenJule commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

Apologies — this PR was closed by mistake on 2026-06-07, and that was an error on my side, not a deliberate decision to withdraw the change.

It happened as an unintended side effect of a branch cleanup in my fork: deleting the head branch automatically closed this PR. The contribution still stands. I have restored the branch and reopened the PR. Sorry for the noise and any confusion this caused.

@BenJule BenJule restored the fix/10512-ams-slot-labels-wrong-unit branch June 7, 2026 11:37
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.

Add Filament in Filament Manager - AMS unit identifier does not reflect any device but "A"

1 participant