Update rpitx.py more txc cleanup

beta-v1.3.2-battery-saver
Alan Johnston 2 years ago committed by GitHub
parent 8ddce2131d
commit 19812e46c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -311,7 +311,7 @@ if __name__ == "__main__":
# if (len(sys.argv)) > 1: # if (len(sys.argv)) > 1:
# print("There are arguments!") # print("There are arguments!")
if (mode == 'a'): if (mode == 'a'):
output(pd, 1) # output(pd, 1)
print("AFSK") print("AFSK")
# sleep(5) # sleep(5)
## try: ## try:
@ -406,12 +406,17 @@ if __name__ == "__main__":
if (command_tx == True): if (command_tx == True):
output(txLed, txLedOn) output(txLed, txLedOn)
output (ptt, 0)
sleep(0.1)
battery_saver_check() battery_saver_check()
if (txc): if (txc):
output (pd, 1)
output (ptt, 0)
sleep(0.1)
system("gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw.txt -r 48000 > /dev/null 2>&1 && aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/morse.wav") system("gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw.txt -r 48000 > /dev/null 2>&1 && aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/morse.wav")
sleep(0.1)
output (ptt, 1)
output (pd, 0)
else: else:
if (debug_mode == 1): if (debug_mode == 1):
system("gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw.txt -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3") system("gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw.txt -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3")
@ -419,7 +424,7 @@ if __name__ == "__main__":
system("gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw.txt -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3 > /dev/null 2>&1") system("gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw.txt -r 48000 > /dev/null 2>&1 && cat /home/pi/CubeSatSim/morse.wav | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo /home/pi/rpitx/rpitx -i- -m RF -f 434.9e3 > /dev/null 2>&1")
output(txLed, txLedOff) output(txLed, txLedOff)
output (ptt, 1) # output (ptt, 1)
sleep(5) sleep(5)
while True: while True:
if (no_command == False and GPIO.input(squelch) == False): if (no_command == False and GPIO.input(squelch) == False):
@ -501,8 +506,8 @@ if __name__ == "__main__":
# while 1: # while 1:
output(txLed, txLedOff) output(txLed, txLedOff)
output (ptt, 1) # output (ptt, 1)
output(pd, 0) # output(pd, 0)
if (camera_present == 1): if (camera_present == 1):
try: try:
file = open("/home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg") file = open("/home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg")
@ -597,12 +602,14 @@ if __name__ == "__main__":
if (command_tx == True): if (command_tx == True):
print ("Sending SSTV image") print ("Sending SSTV image")
output(txLed, txLedOn) output(txLed, txLedOn)
output(pd, 1)
output (ptt, 0)
battery_saver_check() battery_saver_check()
if (txc): if (txc):
output(pd, 1)
output (ptt, 0)
system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/camera_out.jpg.wav") system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/camera_out.jpg.wav")
output(ptt, 1)
output (pd, 0)
else: else:
if (debug_mode == 1): if (debug_mode == 1):
system("cat /home/pi/CubeSatSim/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") system("cat /home/pi/CubeSatSim/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")
@ -610,9 +617,9 @@ if __name__ == "__main__":
system("cat /home/pi/CubeSatSim/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") system("cat /home/pi/CubeSatSim/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")
output(txLed, txLedOff) output(txLed, txLedOff)
output (ptt, 1) # output (ptt, 1)
output(pd, 0) # output(pd, 0)
system("sudo rm /home/pi/CubeSatSim/camera_out.jpg.wav > /dev/null 2>&1") system("sudo rm /home/pi/CubeSatSim/camera_out.jpg.wav > /dev/null 2>&1")
sleep(1) sleep(1)
else: else:
@ -624,12 +631,15 @@ if __name__ == "__main__":
print ("Sending SSTV image") print ("Sending SSTV image")
output(txLed, txLedOn) output(txLed, txLedOn)
output(pd, 1)
output (ptt, 0)
battery_saver_check() battery_saver_check()
if (txc): if (txc):
output(pd, 1)
output (ptt, 0)
system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav") system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav")
output(ptt, 1)
output (pd, 0)
else: else:
if (debug_mode == 1): if (debug_mode == 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") 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")
@ -637,8 +647,8 @@ if __name__ == "__main__":
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") 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")
output(txLed, txLedOff) output(txLed, txLedOff)
output (ptt, 1) # output (ptt, 1)
output(pd, 0) # output(pd, 0)
sleep(1) sleep(1)
except: except:
print("image 1 did not load - copy from CubeSatSim/sstv directory") print("image 1 did not load - copy from CubeSatSim/sstv directory")
@ -678,17 +688,19 @@ if __name__ == "__main__":
else: else:
print("Turning off transmit") print("Turning off transmit")
system("echo > command_tx False") system("echo > command_tx False")
output(pd, 0) # output(pd, 0)
if (command_tx == True): if (command_tx == True):
print ("Sending SSTV image") print ("Sending SSTV image")
output(txLed, txLedOn) output(txLed, txLedOn)
output(pd, 1)
output (ptt, 0)
battery_saver_check() battery_saver_check()
if (txc): if (txc):
output(pd, 1)
output (ptt, 0)
system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav") system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv_image_1_320_x_256.jpg.wav")
output(ptt, 1)
output (pd, 0)
else: else:
if (debug_mode == 1): if (debug_mode == 1):
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") 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")
@ -696,8 +708,8 @@ if __name__ == "__main__":
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") 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")
output(txLed, txLedOff) output(txLed, txLedOff)
output (ptt, 1) # output (ptt, 1)
output(pd, 0) # output(pd, 0)
sleep(5) sleep(5)
except: except:
print("image 2 did not load - copy from CubeSatSim/sstv directory") print("image 2 did not load - copy from CubeSatSim/sstv directory")
@ -708,18 +720,20 @@ if __name__ == "__main__":
if (command_tx == True): if (command_tx == True):
output(txLed, txLedOn) output(txLed, txLedOn)
output(pd, 1)
output (ptt, 0)
battery_saver_check() battery_saver_check()
if (txc): if (txc):
output(pd, 1)
output (ptt, 0)
system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv.wav") system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/sstv.wav")
output(ptt, 1)
output (pd, 0)
else: else:
sleep(60) sleep(60)
output(txLed, txLedOff) output(txLed, txLedOff)
output (ptt, 1) # output (ptt, 1)
output(pd, 0) # output(pd, 0)
sleep(1) sleep(1)
elif (mode == 'b'): elif (mode == 'b'):
print("BPSK") print("BPSK")

Loading…
Cancel
Save

Powered by TurnKey Linux.