From ef8b30702706118c7542514bae0025fd116451d8 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 15:29:19 -0500 Subject: [PATCH] Update fc_block_decode.py bytes --- groundstation/fc_block_decode.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index 9078fd6f..d70aad3f 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -46,12 +46,14 @@ if __name__ == "__main__": if (data_block[FC_PAYLOAD + extended] == 0x55) and (data_block[FC_PAYLOAD + extended + 1] == 0x68): try: print("Writing payload to file") - f = open('image_file','a') - print("File opened") - payload = data_block[(FC_PAYLOAD + extended):] +# f = open('image_file','a') +# print("File opened") + payload = bytearray(data_block[(FC_PAYLOAD + extended):]) print(payload) - payload.tofile(f) - f.close() + immutable_payload = bytes(payload) + with open("image_file", "wb") as binary_file: + binary_file.write(immutable_payload) +# f.close() sleep(60) except: print("File error")