Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/tag/tigertag/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,20 @@
OFF_BED_TEMP_MIN = 30
OFF_BED_TEMP_MAX = 31
OFF_TIMESTAMP = 32
OFF_COLOR2_RGB = 36
OFF_COLOR3_RGB = 40
OFF_TD = 44
OFF_METADATA = 48
OFF_SIGNATURE = 80

# Multi-color aspects, matched by id (not by label, which may be renamed in
# id_aspect.json): aspect id -> number of colors on the chip.
MULTICOLOR_ASPECT_COLOR_COUNT = {
252: 2, # Bicolor
24: 3, # Tricolor
145: 3, # Rainbow
}

MIN_DATA_LENGTH = 96
USER_DATA_PAGE_OFFSET = 4
USER_DATA_BYTE_OFFSET = USER_DATA_PAGE_OFFSET * 4
16 changes: 13 additions & 3 deletions src/tag/tigertag/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ def __parse_tigertag(self, scan_result: ScanResult, user_data: bytes, tag_id: in
a = user_data[Constants.OFF_COLOR_RGBA + 3]
argb_color = (a << 24) | (r << 16) | (g << 8) | b

# Multi-color: a multi-color aspect can be on Aspect 1 or Aspect 2, so
# both are checked and the highest color count wins (spec section 2.5).
# Colors 2 and 3 are stored as RGB and reuse the alpha of color 1.
color_count = max(Constants.MULTICOLOR_ASPECT_COLOR_COUNT.get(aspect1_id, 1),
Constants.MULTICOLOR_ASPECT_COLOR_COUNT.get(aspect2_id, 1))
colors = [argb_color]
for offset in (Constants.OFF_COLOR2_RGB, Constants.OFF_COLOR3_RGB)[:color_count - 1]:
if len(user_data) >= offset + 3:
colors.append((a << 24) | (user_data[offset] << 16) | (user_data[offset + 1] << 8) | user_data[offset + 2])

weight_bytes = user_data[Constants.OFF_WEIGHT:Constants.OFF_WEIGHT + 3]
measure_value = (weight_bytes[0] << 16) | (weight_bytes[1] << 8) | weight_bytes[2]
unit_id = user_data[Constants.OFF_UNIT_ID]
Expand Down Expand Up @@ -93,7 +103,7 @@ def __parse_tigertag(self, scan_result: ScanResult, user_data: bytes, tag_id: in
self.logger.debug(" Brand: %s (ID: %d)", brand_name, brand_id)
self.logger.debug(" Diameter: %.2f mm (ID: %d)", diameter_mm, diameter_id)
self.logger.debug(" Aspect1: %s, Aspect2: %s", aspect1_label, aspect2_label)
self.logger.debug(" Color (ARGB): 0x%08X", argb_color)
self.logger.debug(" Colors (ARGB): %s", " ".join(f"0x{color:08X}" for color in colors))
self.logger.debug(" Measure: %d %s (%.1f g)", measure_value, unit_label, weight_grams)
self.logger.debug(" Nozzle Temp: %d-%d °C", temp_min, temp_max)
self.logger.debug(" Dry: %d °C for %d hours", dry_temp, dry_time)
Expand All @@ -104,13 +114,13 @@ def __parse_tigertag(self, scan_result: ScanResult, user_data: bytes, tag_id: in
return GenericFilament(
source_processor=self.name,
unique_id=GenericFilament.generate_unique_id(
"TigerTag", brand_name, resolved_material_type, argb_color,
"TigerTag", brand_name, resolved_material_type, *colors,
product_id, timestamp_raw
),
manufacturer=brand_name,
type=resolved_material_type,
modifiers=modifiers,
colors=[argb_color],
colors=colors,
diameter_mm=diameter_mm,
weight_grams=weight_grams,
hotend_min_temp_c=float(temp_min),
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
bed_temp_c: 0.0
colors:
- 0xFFDDE5ED
- 0xFF1E90FF
diameter_mm: 1.75
drying_temp_c: 50.0
drying_time_hours: 8.0
hotend_max_temp_c: 230.0
hotend_min_temp_c: 210.0
manufacturer: eSun
manufacturing_date: '2025-11-12'
modifiers:
- Bicolor
- Basic
source_processor: TigerTagProcessor
td: 0.0
type: PLA
unique_id: 2a1b203b21bab0e5f1d1b7d1f905705ad35c35a0cf4a21c03530c082e6d33465
weight_grams: 1000.0
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
bed_temp_c: 0.0
colors:
- 0xFFDDE5ED
- 0xFF1E90FF
- 0xFFFF4500
diameter_mm: 1.75
drying_temp_c: 50.0
drying_time_hours: 8.0
hotend_max_temp_c: 230.0
hotend_min_temp_c: 210.0
manufacturer: eSun
manufacturing_date: '2025-11-12'
modifiers:
- Bicolor
- Tricolor
source_processor: TigerTagProcessor
td: 0.0
type: PLA
unique_id: 037707719b2099739fba91970970075f5f8f21cbb42734ccf8a5c4a12a1742da
weight_grams: 1000.0
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
bed_temp_c: 0.0
colors:
- 0xFFDDE5ED
- 0xFF1E90FF
diameter_mm: 1.75
drying_temp_c: 50.0
drying_time_hours: 8.0
hotend_max_temp_c: 230.0
hotend_min_temp_c: 210.0
manufacturer: eSun
manufacturing_date: '2025-11-12'
modifiers:
- Basic
- Bicolor
source_processor: TigerTagProcessor
td: 0.0
type: PLA
unique_id: 2a1b203b21bab0e5f1d1b7d1f905705ad35c35a0cf4a21c03530c082e6d33465
weight_grams: 1000.0
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
bed_temp_c: 0.0
colors:
- 0xFFDDE5ED
- 0xFF1E90FF
- 0xFFFF4500
diameter_mm: 1.75
drying_temp_c: 50.0
drying_time_hours: 8.0
hotend_max_temp_c: 230.0
hotend_min_temp_c: 210.0
manufacturer: eSun
manufacturing_date: '2025-11-12'
modifiers:
- Rainbow
source_processor: TigerTagProcessor
td: 0.0
type: PLA
unique_id: 037707719b2099739fba91970970075f5f8f21cbb42734ccf8a5c4a12a1742da
weight_grams: 1000.0
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
bed_temp_c: 0.0
colors:
- 0xFFDDE5ED
- 0xFF1E90FF
- 0xFFFF4500
diameter_mm: 1.75
drying_temp_c: 50.0
drying_time_hours: 8.0
hotend_max_temp_c: 230.0
hotend_min_temp_c: 210.0
manufacturer: eSun
manufacturing_date: '2025-11-12'
modifiers:
- Basic
- Tricolor
source_processor: TigerTagProcessor
td: 0.0
type: PLA
unique_id: 037707719b2099739fba91970970075f5f8f21cbb42734ccf8a5c4a12a1742da
weight_grams: 1000.0