Add Color Count

This commit is contained in:
Queen Vinyl Da.i'gyu-Kazotetsu committed 2024-08-05 18:30:31 -07:00
1 parent 33f5b92a7a
commit c1b1b9a4ed
2 files changed
+6 -4

No files matched your search

+4 -3
View File
@@ -488,12 +488,13 @@ Example Data:
### Block 16
Example Data:
`AA AA AA AA BB BB BB BB __ __ __ __ __ __ __ __`
`AA AA BB BB CC CC CC CC __ __ __ __ __ __ __ __`
| position | length | type | Description |
| -------- | ------ | ----------- | ---------------------------------- |
| 0 (AA) | 4 | **Unknown** | **Unknown** |
| 4 (BB) | 4 | RGBA | Second color in _reverse_ hex ABGR |
| 0 (AA) | 2 | **Unknown** | **Unknown** |
| 2 (BB) | 2 | uint16 (LE) | **Color Count...?** |
| 4 (CC) | 4 | RGBA | Second color in _reverse_ hex ABGR |
## Compatible RFID tags - By generation
+2 -1
View File
@@ -99,6 +99,7 @@ class Tag():
"uid": bytes_to_hex(self.blocks[0][0:4]),
"filament_type": bytes_to_string(self.blocks[2]),
"detailed_filament_type": bytes_to_string(self.blocks[4]),
"filament_color_count": bytes_to_int(self.blocks[16][2:4]),
"filament_color": "#" + bytes_to_hex(self.blocks[5][0:4]),
"spool_weight": Unit(bytes_to_int(self.blocks[5][4:6]), "g"),
"filament_length": Unit(bytes_to_int(self.blocks[14][4:6]), "m"),
@@ -142,7 +143,7 @@ class Tag():
self.warnings.append(f"Data found in block {block}, position {pos} that was expected to be blank (received {byte})")
# Check for a second color
if self.blocks[16][4]:
if self.data["filament_color_count"] == 2:
self.data["filament_color"] += " / #" + bytes_to_hex(self.blocks[16][4:8][::-1])
def __str__(self, blocks_to_output = IMPORTANT_BLOCKS):