Call untagged spools by their material and reported colour, not a Bambu colour name

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
dlawler489 2026-09-17 23:55:16 +10:00
parent 88988237ae
commit 73176cc41d

View file

@ -2630,8 +2630,11 @@ function drawnSlots(p) {
// What's in each slot, as last reported, under the drawing.
function loadedHtml(p) {
if (!p.loaded) return p.id ? '<p class="form-hint">Nothing reported yet — “Test & sync” to read it.</p>' : '';
// The tracked spool in that slot names the colour; otherwise the nearest Bambu colour.
// A tagged spool is Bambu's, so its colour has a name: from the tracked spool,
// or the Bambu colour it matches. An untagged one could be any brand, so it
// gets the colour the printer reports and nothing more.
const colourName = (t) => {
if (!t.tagged) return t.colour || '';
const s = spools.find((x) => x.ams_slot === `${p.serial}/${t.unit == null ? 'ext' : t.unit}/${t.slot == null ? 0 : t.slot}`);
return (s && s.colour) || (t.colour ? paletteName(t.colour, t.material) : '') || '';
};