added camera conditional for sstv

pull/120/head
alanbjohnston 5 years ago committed by GitHub
parent bbc726cb8c
commit ba5e62dc96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,6 +8,16 @@ import sys
from picamera import PiCamera
from os import system
try:
camera = PiCamera()
print("Camera present")
camera_present = 1
except:
print("No camera")
camera_present = 0
finally:
print("Continuing")
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_UP)
@ -71,19 +81,25 @@ if __name__ == "__main__":
while 1:
system("(while true; do (sleep 5 && cat /home/pi/CubeSatSim/wav/sstv.wav); done) | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434.9e3 &")
GPIO.output(txLed, txLedOff)
system("raspistill -o /home/pi/camera_out.jpg -w 640 -h 496") # > /dev/null 2>&1")
print("Photo taken")
GPIO.output(txLed, txLedOn)
system("sudo python3 -m pysstv --mode PD120 /home/pi/camera_out.jpg /home/pi/sstv_camera.wav") # > /dev/null 2>&1")
GPIO.output(txLed, txLedOff)
print ("Sending SSTV photo")
time.sleep(1)
system("sudo killall -9 rpitx > /dev/null 2>&1")
system("sudo killall -9 csdr > /dev/null 2>&1")
system("sudo killall -9 cat > /dev/null 2>&1")
GPIO.output(txLed, txLedOn);
system("cat /home/pi/sstv_camera.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434.9e3") # > /dev/null 2>&1")
if (camera_present == 1):
system("raspistill -o /home/pi/camera_out.jpg -w 640 -h 496") # > /dev/null 2>&1")
print("Photo taken")
GPIO.output(txLed, txLedOn)
system("sudo python3 -m pysstv --mode PD120 /home/pi/camera_out.jpg /home/pi/sstv_camera.wav") # > /dev/null 2>&1")
GPIO.output(txLed, txLedOff)
print ("Sending SSTV photo")
time.sleep(1)
system("sudo killall -9 rpitx > /dev/null 2>&1")
system("sudo killall -9 csdr > /dev/null 2>&1")
system("sudo killall -9 cat > /dev/null 2>&1")
GPIO.output(txLed, txLedOn);
system("cat /home/pi/sstv_camera.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434.9e3") # > /dev/null 2>&1")
else:
while 1:
GPIO.output(txLed, txLedOn)
time.sleep(60)
GPIO.output(txLed, txLedOff)
time.sleep(1)
# try:
# camera = PiCamera()
# camera.resolution = (640, 496)

Loading…
Cancel
Save

Powered by TurnKey Linux.