Update transmit.py add check_frequency

master-b3
Alan Johnston 3 months ago committed by GitHub
parent 806119c7d7
commit 59a6fb25f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -435,8 +435,8 @@ def update_doppler(fm="yes"):
else:
new_tx_frequency = tx_frequency
new_rx_frequency = rx_frequency
##### write true freq here ######
check_frequency()
print(f"writing actual tx and rx frequency to frequency.txt Tx Frequency: {new_tx_frequency:.0f} Rx Frequency: {new_rx_frequency:.0f}")
with open("/home/pi/CubeSatSim/frequency.txt", "w") as file:
file.write(f"{new_tx_frequency:.0f} {new_rx_frequency:.0f}")
@ -463,6 +463,34 @@ def update_doppler(fm="yes"):
print("update_doppler failed")
print(f"Frequencies: {frequencies}")
def check_frequency():
global new_tx_frequency
global new_rx_frequency
tx_OK = False
rx_OK = False
if new_tx_frequency > 450000000:
new_tx_frequency = 435200000
elif (new_tx_frequency < 420000000) and (new_tx_frequency > 148000000):
new_tx_frequency = 434700000
elif (new_tx_frequency < 144000000):
new_tx_frequency = 434600000
else:
tx_OK = True
if new_rx_frequency > 450000000:
new_rx_frequency = 435200000
elif (new_rx_frequency < 420000000) and (new_rx_frequency > 148000000):
new_rx_frequency = 434700000
elif (new_rx_frequency < 144000000):
new_rx_frequency = 434600000
else:
rx_OK = True
if (tx_OK != True) or (rx_OK != True):
print("Error - frequency out of range!")
morse_table = [ # 0-9, A-Z only by (ASCII - 48)
[ 3, 3, 3, 3, 3, 0 ], # 0
[ 1, 3, 3, 3, 3, 0 ], # 1

Loading…
Cancel
Save

Powered by TurnKey Linux.