Manually resolved merge conflicts and tested parse.py

This commit is contained in:
Mitch Davis committed 2024-11-19 11:06:23 -05:00
commit f76ed40e4f
2 files changed
+37 -5

No files matched your search

+28 -3
View File
@@ -35,6 +35,7 @@ We are currently working on a way to submit the tag data in a secure way so anal
* [Block 12](#block-12)
* [Block 13](#block-13)
* [Block 14](#block-14)
* [Block 16](#block-16)
* [Compatible RFID tags - By generation](#compatible-rfid-tags----by-generation)
<!--te-->
@@ -323,8 +324,8 @@ Summary of what kind of data is stored in each block. Detailed info for each blo
| 3 | 1 | [Block 13](#block-13) Short Production Date/Time |
| 3 | 2 | [Block 14](#block-14) Filament Length |
| 3 | 3 | [Block 15](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 4 | 0 | **Empty** |
| 4 | 1 | **Empty** |
| 4 | 0 | [Block 16](#block-16) Extra Color Info |
| 4 | 1 | [Block 17](#block-17) **Unknown** |
| 4 | 2 | **Empty** |
| 4 | 3 | [Block 19](#mifare-encryption-keys) MIFARE encryption keys, Unrelated to BambuLab |
| 5 | 0 | **Empty** |
@@ -424,7 +425,7 @@ Example Data:
| position | length | type | Description |
| -------- | ------ | ----------- | -------------------------------------------- |
| 0 (AA) | 4 | RGBA | Color in hex RBGA |
| 0 (AA) | 4 | RGBA | Color in hex RGBA |
| 4 (BB) | 2 | uint16 (LE) | Spool Weight in grams (`E8 03` --> 1000 g) |
| 8 (CC) | 8 | float (LE) | Filament Diameter in milimeters |
@@ -497,6 +498,30 @@ Example Data:
| -------- | ------ | ----------- | --------------------------------- |
| 4 (AA) | 2 | uint16 (LE) | **Filament length in meters...?** |
### Block 16
Example Data:
`AA AA BB BB CC CC CC CC __ __ __ __ __ __ __ __`
| position | length | type | Description |
| -------- | ------ | ----------- | ---------------------------------- |
| 0 (AA) | 2 | uint16 (LE) | Format Identifier |
| 2 (BB) | 2 | uint16 (LE) | Color Count |
| 4 (CC) | 4 | RGBA | Second color in _reverse_ hex ABGR |
Known Format Identifiers:
- 00 00 = Empty
- 02 00 = Color Info
### Block 17
Example Data:
`AA AA __ __ __ __ __ __ __ __ __ __ __ __ __ __`
| position | length | type | Description |
| -------- | ------ | ----------- | ---------------------------------- |
| 0 (AA) | 2 | **Unknown** | **Unknown** |
## Compatible RFID tags - By generation
There are tags known as "Magic Tags" which allow functionality that's not part of the classic MIFARE spec.
+9 -2
View File
@@ -100,10 +100,13 @@ class Tag():
self.warnings.append(f"Block {bi} is blank!")
# Parse the data
has_extra_color_info = self.blocks[16][0:2] == b'\x02\x00'
self.data = {
"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]) if has_extra_color_info else 1,
"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"),
@@ -123,10 +126,14 @@ class Tag():
"x_cam_info": self.blocks[8][0:12],
"tray_uid": self.blocks[9],
"production_date": bytes_to_date(self.blocks[12]),
"unknown": bytes_to_string(self.blocks[13]), # Appears to be some sort of date -- on some tags, this is identical to the production date, but not always
"unknown_1": bytes_to_string(self.blocks[13]), # Appears to be some sort of date -- on some tags, this is identical to the production date, but not always
"unknown_2": self.blocks[17][0:2], # Only been "0100" on the PLA Silk Dual Color, "0000" otherwise
}
# Check for a second color
if self.data["filament_color_count"] == 2:
self.data["filament_color"] += " / #" + bytes_to_hex(self.blocks[16][4:8][::-1])
# Check for any data in bits that are expected to be blank
expected_to_be_blank = {
5: [*range(6,8),*range(12,16)],