Master is now using the same FW_Update Methode as the Slaves

This commit is contained in:
2024-05-24 01:58:53 +02:00
parent 66e04c6e06
commit d0544576a3
10 changed files with 198 additions and 89 deletions

View File

@@ -30,7 +30,7 @@ def make_header(typeid: PackageType, length: int) -> bytearray:
struct_format = '<HHB' # '<' for little-endian, 'H' for uint16_t, 'B' for uint8_t
# Calculate the check byte as the sum of length and type
typeidint = int(typeid)
check = (length & 0xFF) + ((length >> 8) & 0xFF) + (typeidint & 0xFF) + ((typeidint >> 8) & 0xFF)
check = ((length & 0xFF) + ((length >> 8) & 0xFF) + (typeidint & 0xFF) + ((typeidint >> 8) & 0xFF) ) & 0xff
packed_data = struct.pack(struct_format, length, typeid, check)
return packed_data