Update rpitx.py extra command and control checks

beta-cc-hi
Alan Johnston 2 years ago committed by GitHub
parent a55e459b3d
commit 027afa409a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -372,7 +372,6 @@ if __name__ == "__main__":
print("Programming FM module!\n"); print("Programming FM module!\n");
output(pd, 1) output(pd, 1)
output (ptt, 1) output (ptt, 1)
try: try:
ser = serial.Serial("/dev/ttyAMA0", 9600) ser = serial.Serial("/dev/ttyAMA0", 9600)
print(ser.portstr) print(ser.portstr)
@ -385,12 +384,13 @@ if __name__ == "__main__":
except: except:
print("Error in serial write") print("Error in serial write")
ser.close() ser.close()
output(pd, 0) output(pd, 0)
sleep(10) # delay so cubesatsim code catches up sleep(10) # delay so cubesatsim code catches up
system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1") system("echo 'hi hi de " + callsign + "' > id.txt && gen_packets -M 20 /home/pi/CubeSatSim/id.txt -o /home/pi/CubeSatSim/morse.wav -r 48000 > /dev/null 2>&1")
command_control_check()
# if (mode != 'a') and (command_tx == True): # if (mode != 'a') and (command_tx == True):
if (command_tx == True): if (command_tx == True):
@ -426,14 +426,9 @@ 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'):
command_control_check()
# output(pd, 1) # output(pd, 1)
print("AFSK") print("AFSK")
# sleep(5)
## try:
## file = open("/home/pi/CubeSatSim/t.txt")
## file.close()
## except:
## system("echo '" + callsign + "-11>APCSS:hi hi 100 199 199 199 298 299 299 278 380 350 300 300 439 400 400 400 500 500 500 500 600 600 600 650' > /home/pi/CubeSatSim/t.txt && echo 'AMSAT>APCSS:010101/hi hi ' >> /home/pi/CubeSatSim/t.txt")
while True: while True:
try: try:
f = open("/home/pi/CubeSatSim/ready") f = open("/home/pi/CubeSatSim/ready")
@ -480,72 +475,23 @@ if __name__ == "__main__":
sleep(1) sleep(1)
elif (mode == 'm'): elif (mode == 'm'):
print("CW") print("CW")
# sleep(4)
# try:
# file = open("/home/pi/CubeSatSim/cw.txt")
# file.close()
# except:
# system("echo 'hi hi 100 199 199 199 298 299 299 278 380 350 300 300 439 400 400 400 500 500 500 500 600 600 600 650' > /home/pi/CubeSatSim/cw.txt")
# output(pd, 1)
#
# if (command_tx == True):
# output(txLed, txLedOn)
# battery_saver_check()
#
# 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")
# sleep(0.1)
# output (ptt, 1)
# output (pd, 0)
# else:
# 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 " + tx + "e3")
# else:
# 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 " + tx + "e3 > /dev/null 2>&1")
#
# output(txLed, txLedOff)
# output (ptt, 1)
# sleep(5)
while True: while True:
command_control_check() command_control_check()
# print("don't command control check 0")
try: try:
f = open("/home/pi/CubeSatSim/cwready") f = open("/home/pi/CubeSatSim/cwready")
f.close() f.close()
system("sudo rm /home/pi/CubeSatSim/cwready") system("sudo rm /home/pi/CubeSatSim/cwready")
print("after rm")
ch = 1 ch = 1
print("after ch")
# print(channel)
for chan in range(7): for chan in range(7):
# print(channel) command = "gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw" + str(chan) + ".txt -r 48000 > /dev/null 2>&1"
print(chan)
print("after for chan")
print("done for")
for chan in range(7):
print("for loop")
command = "gen_packets -M 20 -o /home/pi/CubeSatSim/morse.wav /home/pi/CubeSatSim/cw" + str(ch) + ".txt -r 48000 > /dev/null 2>&1"
print("after command assignment")
system(command) system(command)
print("for loop1") chan = chan + 1
ch = ch + 1
print("for loop2")
# print("Sending cw1.txt")
# system("cat /home/pi/CubeSatSim/cw1.txt")
if (command_tx == True): if (command_tx == True):
print("for loop3")
output(txLed, txLedOn) output(txLed, txLedOn)
output (pd, 1) output (pd, 1)
sleep(0.1) sleep(0.1)
output (ptt, 0) output (ptt, 0)
# battery_saver_check()
if (txc): if (txc):
system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/morse.wav") system("aplay -D hw:CARD=Headphones,DEV=0 /home/pi/CubeSatSim/morse.wav")
@ -558,23 +504,15 @@ if __name__ == "__main__":
sleep(0.1) sleep(0.1)
output(txLed, txLedOff) output(txLed, txLedOff)
output (ptt, 1) output (ptt, 1)
print("for loop4")
print("for loop5")
print(chan)
command_control_check() command_control_check()
# print("dont command control check")
print("for loop6")
print(chan)
print("done 2nd for")
f.close() f.close()
# system("sudo rm /home/pi/CubeSatSim/cwready")
sleep(5) sleep(5)
except: except:
command_control_check() command_control_check()
# print("dont command control check 1")
sleep(1) sleep(1)
elif (mode == 's'): elif (mode == 's'):
print("SSTV") print("SSTV")
command_control_check()
try: try:
# from picamera import PiCamera # from picamera import PiCamera
# from pysstv.sstv import SSTV # from pysstv.sstv import SSTV
@ -600,6 +538,7 @@ if __name__ == "__main__":
file = open("/home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg") file = open("/home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg")
print("First SSTV stored image detected") print("First SSTV stored image detected")
system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg") system("/home/pi/PiSSTVpp/pisstvpp -r 48000 -p s2 /home/pi/CubeSatSim/sstv_image_2_320_x_256.jpg")
command_control_check()
if (command_tx == True): if (command_tx == True):
print ("Sending SSTV image") print ("Sending SSTV image")
@ -756,7 +695,7 @@ if __name__ == "__main__":
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 " + tx + "e3 &") 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 " + tx + "e3 &")
while 1: while 1:
if (command_tx == True): if (command_tx == True):
command_control_check()
output(txLed, txLedOn) output(txLed, txLedOn)
# battery_saver_check() # battery_saver_check()
@ -773,7 +712,9 @@ if __name__ == "__main__":
# output (ptt, 1) # output (ptt, 1)
# output(pd, 0) # output(pd, 0)
sleep(1) sleep(1)
elif (mode == 'b'): elif (mode == 'b'):
command_control_check()
print("BPSK") print("BPSK")
print("turn on FM rx") print("turn on FM rx")
output(pd, 1) output(pd, 1)

Loading…
Cancel
Save

Powered by TurnKey Linux.