Update fc_block_decode.py with open

fc-fctelem
Alan Johnston 10 months ago committed by GitHub
parent eb5d4e2f45
commit 7d4451509c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -72,28 +72,28 @@ if __name__ == "__main__":
# print(process.stdout) # print(process.stdout)
# s = io.StringIO(process.stdout) # s = io.StringIO(process.stdout)
# for line in s: # for line in s:
ssdv_output_file = open("ssdv_output", "r") with open("ssdv_output", "r") as file:
for line in ssdv_output_file: for line in file:
print("line:") print("line:")
print(line) print(line)
if ((line.find("Image ID:")) > 0): if ((line.find("Image ID:")) > 0):
print("\nImage ID found!\n") print("\nImage ID found!\n")
image_id_string = line.split() image_id_string = line.split()
print(image_id_string) print(image_id_string)
new_image_count = int(image_id_string[1]) new_image_count = int(image_id_string[1])
if (new_image_count != image_count): if (new_image_count != image_count):
image_count = new_image_coount image_count = new_image_coount
print("End of image") print("End of image")
filename = "image_file" + str(image_count) + ".jpeg" filename = "image_file" + str(image_count) + ".jpeg"
system("/home/pi/ssdv/ssdv -d -J image_file " + filename) system("/home/pi/ssdv/ssdv -d -J image_file " + filename)
system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg")
system("sudo mv image_file image_file" + str(image_count)) system("sudo mv image_file image_file" + str(image_count))
print("Image count: ") print("Image count: ")
print(image_count) print(image_count)
# image_count = (image_count + 1) % 256 # image_count = (image_count + 1) % 256
image_index = 0 image_index = 0
else: else:
image_index += 1 image_index += 1
system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg")
# image = Image.open("image_file" + str(image_count) + "." + str(image_index) + ".jpeg") # image = Image.open("image_file" + str(image_count) + "." + str(image_index) + ".jpeg")

Loading…
Cancel
Save

Powered by TurnKey Linux.