From f1aaf5d9b85ae5ffba5352a07492d4db095a46ed Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Thu, 6 Feb 2025 22:16:24 -0500 Subject: [PATCH] Update fc_block_decode.py add image display --- groundstation/fc_block_decode.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/groundstation/fc_block_decode.py b/groundstation/fc_block_decode.py index d5c80ba3..18cf3f88 100644 --- a/groundstation/fc_block_decode.py +++ b/groundstation/fc_block_decode.py @@ -3,6 +3,8 @@ from os import system from time import sleep import logging import random +from PIL import Image, ImageDraw, ImageFont, ImageColor + logging.basicConfig(format='%(message)s') # logging.warning('CC-Warning!') @@ -49,21 +51,18 @@ 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 = bytearray(data_block[(FC_PAYLOAD + extended):]) immutable_payload = bytes(bytearray(data_block[(FC_PAYLOAD + extended):])) # payload) print(immutable_payload) with open("image_file", "ab") as binary_file: binary_file.write(immutable_payload) -# binary_file.close() -# sleep(60) except: print("File error") else: print("End of image") system("/home/pi/ssdv/ssdv -d -J image_file image_file" + str(image_count) + ".jpeg") + image = Image.open(image_file" + str(image_count) + ".jpeg") + image.show() # system("sudo rm image_file") system("sudo mv image_file image_file" + str(image_count)) print("Image count: ")