From 0f2ff9e038a851352b769dd96dd649b5aa03c771 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sun, 6 Jun 2021 07:24:35 -0400 Subject: [PATCH] trying SSTV image 1 and 2 if present --- rpitx.py | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/rpitx.py b/rpitx.py index 7d8d7ef7..fdd2ebcd 100644 --- a/rpitx.py +++ b/rpitx.py @@ -83,16 +83,16 @@ if __name__ == "__main__": print("No camera") camera_present = 0 try: - file = open("/home/pi/initial_image.jpg") - print("Initial image detected") - system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/initial_image.jpg") - print ("Sending SSTV photo") + file = open("/home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg") + print("First SSTV stored image detected") + system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg") + print ("Sending SSTV image") GPIO.output(txLed, txLedOn); - system("cat /home/pi/initial_image.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434.9e3") # > /dev/null 2>&1") + system("cat /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434.9e3") # > /dev/null 2>&1") GPIO.output(txLed, txLedOff) # time.sleep(1) except: - print("No initial image") + print("No first image") # while 1: GPIO.output(txLed, txLedOff) if (camera_present == 1): @@ -100,18 +100,29 @@ if __name__ == "__main__": system("raspistill -o /home/pi/camera_out.jpg -w 320 -h 256") # > /dev/null 2>&1") print("Photo taken") system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/camera_out.jpg") - print ("Sending SSTV photo") + print ("Sending SSTV image") GPIO.output(txLed, txLedOn); system("cat /home/pi/camera_out.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434.9e3") # > /dev/null 2>&1") GPIO.output(txLed, txLedOff) time.sleep(1) else: - 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 &") - while 1: - GPIO.output(txLed, txLedOn) - time.sleep(60) - GPIO.output(txLed, txLedOff) - time.sleep(1) + try: + file = open("/home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg") + print("Second SSTV stored image detected") + system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg") + while 1: + print ("Sending SSTV image") + GPIO.output(txLed, txLedOn); + system("cat /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg.wav | csdr convert_i16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434.9e3") # > /dev/null 2>&1") + GPIO.output(txLed, txLedOff) + time.sleep(5) + except: + 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 &") + while 1: + GPIO.output(txLed, txLedOn) + time.sleep(60) + GPIO.output(txLed, txLedOff) + time.sleep(1) elif (('b' == sys.argv[1]) or ('bpsk' in sys.argv[1])): print("BPSK")