|
|
|
|
@ -523,29 +523,29 @@ def update_doppler(fm):
|
|
|
|
|
global mode
|
|
|
|
|
global tx
|
|
|
|
|
print("update_doppler")
|
|
|
|
|
try:
|
|
|
|
|
relative_time = (time.perf_counter() - start_time) % 370
|
|
|
|
|
except:
|
|
|
|
|
start_time = time.perf_counter()
|
|
|
|
|
relative_time = (time.perf_counter() - start_time) % 370
|
|
|
|
|
index = int(relative_time/10)
|
|
|
|
|
print(f"relative time: {relative_time:.1f} seconds after AOS is index: {index}")
|
|
|
|
|
table_row = doppler_table[index]
|
|
|
|
|
rx_doppler_shift_hz = table_row["doppler_434_khz"] * 1000
|
|
|
|
|
if (mode == 'e'):
|
|
|
|
|
tx_doppler_shift_hz = table_row["doppler_144_khz"] * 1000
|
|
|
|
|
|
|
|
|
|
with open("/home/pi/CubeSatSim/frequency.txt", "r") as file:
|
|
|
|
|
frequencies = file.read().split()
|
|
|
|
|
|
|
|
|
|
new_tx_frequency = int(frequencies[0])
|
|
|
|
|
new_rx_frequency = int(frequencies[1])
|
|
|
|
|
|
|
|
|
|
print(f"New frequencies: {new_tx_frequency}, Second number: {new_tx_frequency}")
|
|
|
|
|
|
|
|
|
|
if (tx_doppler_freq_hz != new_tx_frequency) or (rx_doppler_freq_hz != new_rx_frequency):
|
|
|
|
|
tx_doppler_freq_hz = new_tx_frequency
|
|
|
|
|
rx_doppler_freq_hz = new_rx_frequency
|
|
|
|
|
print(f"Tx Doppler shift: {tx_doppler_freq_hz:.0f}")
|
|
|
|
|
rx_doppler_freq_hz = rx_doppler_start_hz + rx_doppler_shift_hz
|
|
|
|
|
print(f"Rx Doppler shift: {rx_doppler_freq_hz:.0f}")
|
|
|
|
|
if (fm != "no"):
|
|
|
|
|
rx = "{:.4f}".format(rx_doppler_freq_hz/1e6)
|
|
|
|
|
if (mode != 'e'):
|
|
|
|
|
tx = "{:.4f}".format(tx_doppler_freq_hz/1e6)
|
|
|
|
|
print(tx)
|
|
|
|
|
program_fm(rx,tx,rxpl_value,sq,txpl_value)
|
|
|
|
|
else:
|
|
|
|
|
tx_doppler_shift_hz = rx_doppler_shift_hz
|
|
|
|
|
tx_doppler_freq_hz = tx_doppler_start_hz + tx_doppler_shift_hz
|
|
|
|
|
print(f"Tx Doppler shift: {tx_doppler_freq_hz:.0f}")
|
|
|
|
|
rx_doppler_freq_hz = rx_doppler_start_hz + rx_doppler_shift_hz
|
|
|
|
|
print(f"Rx Doppler shift: {rx_doppler_freq_hz:.0f}")
|
|
|
|
|
if (fm != "no"):
|
|
|
|
|
rx = "{:.4f}".format(rx_doppler_freq_hz/1e6)
|
|
|
|
|
if (mode != 'e'):
|
|
|
|
|
tx = "{:.4f}".format(tx_doppler_freq_hz/1e6)
|
|
|
|
|
print(tx)
|
|
|
|
|
program_fm(rx,tx,rxpl_value,sq,txpl_value)
|
|
|
|
|
print("No frequency changes!")
|
|
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
print("update_doppler failed")
|
|
|
|
|
|