Add Color Count

This commit is contained in:
Queen Vinyl Da.i'gyu-Kazotetsu committed 2024-06-14 21:11:52 -07:00
1 parent 7a4a57b0aa
commit 3073f81c9f
2 files changed
+6 -4

No files matched your search

+4 -3
View File
@@ -452,12 +452,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
@@ -97,6 +97,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"),
@@ -121,7 +122,7 @@ class Tag():
}
# 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):