Update program_fm.py fix tabs

fiabv4-auto-tune-fm
Alan Johnston 1 month ago committed by GitHub
parent dcf1467dda
commit 5bb7950848
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2,38 +2,39 @@ import serial
from os import system from os import system
if __name__ == "__main__": if __name__ == "__main__":
txf = 434.9 txf = 434.9
rxf = 435 rxf = 435
if (len(sys.argv)) > 1: if (len(sys.argv)) > 1:
print("There are arguments!") print("There are arguments!")
txf = float(sys.argv[1]) txf = float(sys.argv[1])
if (len(sys.argv)) > 2: if (len(sys.argv)) > 2:
rxf = loat(sys.argv[2]) rxf = loat(sys.argv[2])
print("Programming FM module!\n") print("Programming FM module!\n")
tx = "{:.4f}".format(txf) tx = "{:.4f}".format(txf)
rx = "{:.4f}".format(rxf) rx = "{:.4f}".format(rxf)
print(tx) print(tx)
print(rx) print(rx)
output(pd, 1) output(pd, 1)
output (ptt, 1) output (ptt, 1)
system("gpio -g mode 20 out") system("gpio -g mode 20 out")
system("gpio -g write 20 1") system("gpio -g write 20 1")
system("gpio -g mode 21 out # set PD high") system("gpio -g mode 21 out # set PD high")
system("gpio -g write 21 1") system("gpio -g write 21 1")
try: try:
ser = serial.Serial("/dev/ttyAMA0", 9600) ser = serial.Serial("/dev/ttyAMA0", 9600)
print(ser.portstr) print(ser.portstr)
uhf_string = "AT+DMOSETGROUP=0," + rx +"," + tx + ",0,3,0,0\r\n" uhf_string = "AT+DMOSETGROUP=0," + rx +"," + tx + ",0,3,0,0\r\n"
# uhf_string = "AT+DMOSETGROUP=0," + rx + "," + tx + "," + rxpl_value + "," + sq + "," + txpl_value + ",0\r\n" # uhf_string = "AT+DMOSETGROUP=0," + rx + "," + tx + "," + rxpl_value + "," + sq + "," + txpl_value + ",0\r\n"
print(uhf_string) print(uhf_string)
for i in range(6): for i in range(6):
# ser.write(b"AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r\n") # ser.write(b"AT+DMOSETGROUP=0,435.0000,434.9000,0,3,0,0\r\n")
ser.write(uhf_string.encode()) ser.write(uhf_string.encode())
sleep(0.1) sleep(0.1)
ser.close() ser.close()
ser = serial.Serial("/dev/ttyAMA0", 115200) # reset back to 115200 for cubesatsim code for payload sensor data ser = serial.Serial("/dev/ttyAMA0", 115200) # reset back to 115200 for cubesatsim code for payload sensor data
except: except:
print("Error in serial write") print("Error in serial write")
system("gpio -g write 21 0")
system("gpio -g write 21 0")

Loading…
Cancel
Save

Powered by TurnKey Linux.