From fcb63555bdce438a6c5da092d6d3dff4ea52ebc2 Mon Sep 17 00:00:00 2001 From: Rrrrobert Date: Thu, 15 Oct 2026 18:27:14 -0400 Subject: [PATCH] OpenSpool: parse additional_color_hexes for multicolor spools OpenSpool tags may carry extra colors in `additional_color_hexes` (used by the Snapmaker U1 extended firmware for dual/rainbow spools). The processor previously kept only `color_hex`, dropping the rest. Append up to 4 additional colors (5 total, matching the U1's FILAMENT_PROTO_COLOR_NUMS_MAX) to `colors`, using the tag's alpha. Single-color tags produce the same output and unique_id as before. Adds a dual-color (red/blue) OpenSpool fixture. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011NVRoJLjL7JBmLBtmjrTrv --- src/tag/openspool/processor.py | 10 ++++++++-- .../eSUN PLA Silk Red Blue OpenSpool.bin | Bin 0 -> 540 bytes .../eSUN PLA Silk Red Blue OpenSpool.yml | 18 ++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 test/tags/OpenSpool/eSUN PLA Silk Red Blue OpenSpool.bin create mode 100644 test/tags/OpenSpool/eSUN PLA Silk Red Blue OpenSpool.yml diff --git a/src/tag/openspool/processor.py b/src/tag/openspool/processor.py index f8eb523..ec6f7ad 100644 --- a/src/tag/openspool/processor.py +++ b/src/tag/openspool/processor.py @@ -47,6 +47,12 @@ def __openspool_parse_payload(self, payload : bytes) -> GenericFilament | None: alpha = max(0x00, min(0xFF, int(data.get('alpha', 'FF'), 16))) color_argb = (alpha << 24) | color_hex + colors = [color_argb] + additional = data.get('additional_color_hexes') or [] + if isinstance(additional, list): + for extra_hex in additional[:4]: + colors.append((alpha << 24) | self.__parse_color_hex(extra_hex)) + try: diameter_mm = float(data.get('diameter', 1.75)) except (ValueError, TypeError): @@ -76,11 +82,11 @@ def __openspool_parse_payload(self, payload : bytes) -> GenericFilament | None: return GenericFilament( source_processor=self.name, - unique_id=GenericFilament.generate_unique_id("OpenSpool", brand, main_type, subtype, color_argb), + unique_id=GenericFilament.generate_unique_id("OpenSpool", brand, main_type, subtype, *colors), manufacturer=brand, type=main_type, modifiers=[subtype] if subtype else [], - colors=[color_argb], + colors=colors, diameter_mm=diameter_mm, weight_grams=weight_grams, hotend_min_temp_c=min_temp, diff --git a/test/tags/OpenSpool/eSUN PLA Silk Red Blue OpenSpool.bin b/test/tags/OpenSpool/eSUN PLA Silk Red Blue OpenSpool.bin new file mode 100644 index 0000000000000000000000000000000000000000..ed49af9d7672b8af1f91db53e8a4b7072c266255 GIT binary patch literal 540 zcmZSSo1P$^=NVQjm8BLH1G!38 zN``s{N;*mfMfoN9$@w`zf&7BhyyAj