diff --git a/README.md b/README.md index 6256472..ce72079 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/parse.py b/parse.py index 47fb7f4..adddf9c 100644 --- a/parse.py +++ b/parse.py @@ -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):