File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 15
15
bin_data = bytearray (in_file .read ())
16
16
in_file .close ()
17
17
18
+ # Magic number (VID/PID), hard coded for MKR VIDOR 4000 right now
19
+ magic_number = bytearray ([0x23 , 0x41 , 0x80 , 0x54 ])
20
+ print (magic_number )
21
+
22
+ # Version field (byte array of size 8)
23
+ version = bytearray (8 )
24
+ print (version )
25
+
26
+ # Prepend magic number and version field to payload
27
+ bin_data_complete = magic_number + version + bin_data
28
+
18
29
# Calculate length and CRC32
19
- bin_data_len = len (bin_data )
20
- bin_data_crc = crccheck .crc .Crc32 .calc (bin_data )
30
+ bin_data_len = len (bin_data_complete )
31
+ bin_data_crc = crccheck .crc .Crc32 .calc (bin_data_complete )
21
32
22
33
# Write to outfile
23
34
out_file = open (ofile , "wb" )
24
35
out_file .write ((bin_data_len ).to_bytes (4 ,byteorder = 'little' ))
25
36
out_file .write ((bin_data_crc ).to_bytes (4 ,byteorder = 'little' ))
26
- out_file .write (bin_data )
37
+ out_file .write (bin_data_complete )
27
38
out_file .close ()
You can’t perform that action at this time.
0 commit comments