Update transmit.py add fail camera mode check

sim-fail-3
Alan Johnston 4 months ago committed by GitHub
parent 3f2b3ad7b7
commit 899a2927c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -15,11 +15,16 @@ import random
def sim_failure_check():
try:
global card
global cam_fail
cam_fail = False
file = open("/home/pi/CubeSatSim/failure_mode.txt")
fail_mode = file.read(2)
if (fail_mode == "10"):
card = "Device" # Change audio so no FM audio plays
print("Failure mode no FM audio")
else if (fail_mode == "6"):
cam_fail = True
print("Failure mode camera fail")
else:
print("Other failure mode")
card = "Headphones"
@ -110,6 +115,7 @@ def increment_mode():
print("can't write to .mode file")
def camera_photo():
sim_failure_check()
system("sudo rm /home/pi/CubeSatSim/camera_out.jpg")
stored_image = False
try:
@ -117,6 +123,10 @@ def camera_photo():
f = open("/home/pi/CubeSatSim/camera_out.jpg")
f.close()
print("Photo taken")
if (cam_fail == True):
system("cp /home/pi/CubeSatSim/sstv//sstv_image_2_320_x_256.jpeg /home/pi/CubeSatSim/camera_out.jpg")
print("Using stored image")
stored_image = True
except:
system("cp /home/pi/CubeSatSim/sstv//sstv_image_2_320_x_256.jpeg /home/pi/CubeSatSim/camera_out.jpg")
print("Using stored image")
@ -596,35 +606,7 @@ if __name__ == "__main__":
print("image 2 did not load - copy from CubeSatSim/sstv directory")
while 1:
# command_control_check()
camera_photo()
## system("raspistill -o /home/pi/CubeSatSim/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1")
## print("Photo taken")
##
## file='/home/pi/CubeSatSim/camera_out.jpg'
## font1 = ImageFont.truetype('DejaVuSerif.ttf', 20)
## font2 = ImageFont.truetype('DejaVuSerif-Bold.ttf', 16)
##
## try:
## filep = open("/home/pi/CubeSatSim/telem_string.txt")
## telem_string = filep.readline()
## except:
## telem_string = ""
## if (debug_mode == 1):
## print("Can't read telem_string.txt")
## print(telem_string)
##
## img = Image.open(file)
## draw = ImageDraw.Draw(img)
# draw.text((10, 10), callsign, font=font2, fill='white')
# draw.text((120, 10), telem_string, font=font2, fill='white')
## draw.text((12, 12), callsign, font=font1, fill='black')
## draw.text((10, 10), callsign, font=font1, fill='white')
## draw.text((122, 12), telem_string, font=font2, fill='black')
## draw.text((120, 10), telem_string, font=font2, fill='white')
## img.save(file)
# command_control_check()
camera_photo()
system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/CubeSatSim/camera_out.jpg")
system("sudo rm /home/pi/CubeSatSim/camera_out.jpg > /dev/null 2>&1")

Loading…
Cancel
Save

Powered by TurnKey Linux.