Update fc_block_decode.py change to image_id and _count

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

@ -16,8 +16,8 @@ FC_SW = 50
FC_PAYLOAD = 55 FC_PAYLOAD = 55
extended = 1 extended = 1
image_count = random.randint(0, 255) image_id = random.randint(0, 255)
image_index = 0; image_count = 0;
system("sudo rm image_file") system("sudo rm image_file")
if __name__ == "__main__": if __name__ == "__main__":
@ -63,7 +63,7 @@ if __name__ == "__main__":
except: except:
print("File error") print("File error")
# try: # try:
filename = "/home/pi/fctelem/image_file" + str(image_count) + "." + str(image_index) + ".jpeg" filename = "/home/pi/fctelem/image_file" + str(image_id) + "." + str(image_count) + ".jpeg"
system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename + " 2>&1 | tee /home/pi/fctelem/ssdv_output") system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename + " 2>&1 | tee /home/pi/fctelem/ssdv_output")
# process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True) # process = subprocess.run(["/home/pi/ssdv/ssdv","-d","-J", "image_file", filename], text=True)
# print("\n\n RESULT: \n") # print("\n\n RESULT: \n")
@ -72,10 +72,10 @@ 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:
print("After ssdv") # print("After ssdv")
system("cat /home/pi/fctelem/ssdv_output") # system("cat /home/pi/fctelem/ssdv_output")
with open("/home/pi/fctelem/ssdv_output", "r") as file: with open("/home/pi/fctelem/ssdv_output", "r") as file:
print("Starting with") # print("Starting with")
for line in file: for line in file:
# print("line:") # print("line:")
# print(line) # print(line)
@ -83,23 +83,23 @@ if __name__ == "__main__":
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[2], 16) new_image_id = int(image_id_string[2], 16)
print(new_image_count) print(new_image_id)
if (new_image_count != image_count): if (new_image_id != image_id):
image_count = new_image_count image_id = new_image_id
print("End of image") print("End of image")
filename = "/home/pi/fctelem/image_file" + str(image_count) + ".jpeg" newfilename = "/home/pi/fctelem/image_file" + str(image_id) + ".jpeg"
system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename) # system("/home/pi/ssdv/ssdv -d -J /home/pi/fctelem/image_file " + filename)
system("sudo cp " + filename + " /home/pi/CubeSatSim/groundstation/public_html/image_file.jpeg") system("sudo cp " + newfilename + filename)
system("sudo mv /home/pi/fctelem/image_file /home/pi/fctelem/image_file" + str(image_count)) system("sudo mv /home/pi/fctelem/image_file /home/pi/fctelem/image_file" + str(image_id))
print("Image count: ") print("Image ID: ")
print(image_count) print(image_id)
# image_count = (image_count + 1) % 256 # image_count = (image_count + 1) % 256
image_index = 0 image_count = 0
else: else:
image_index += 1 image_count += 1
print("image_index:") print("image_count:")
print(image_index) print(image_count)
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.