Update auto-tune.py catch rtl failure

fiabv4-auto-tune
Alan Johnston 2 months ago committed by GitHub
parent 52c0a2a930
commit 4aaa8daabe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -18,8 +18,8 @@ if __name__ == "__main__":
sampling_rate = 1024e3 # 250e3 # Hz
duration = 65536/sampling_rate # 1 # seconds
t = np.linspace(0, duration, int(sampling_rate * duration), endpoint=False)
try:
sdr = RtlSdr()
# configure device
@ -32,7 +32,7 @@ if __name__ == "__main__":
# signal = sdr.read_samples(64*1024) #256
signal = sdr.read_samples(duration*sampling_rate).real #256
# print(f"Center frequency is {center_frequency}")
# print(f"Center frequency is {center_frequency}")
sdr.close()
@ -50,6 +50,8 @@ if __name__ == "__main__":
if (graph == 'y'):
# Plotting the results
t = np.linspace(0, duration, int(sampling_rate * duration), endpoint=False)
plt.figure(figsize=(12, 6))
plt.subplot(1, 2, 1)
@ -82,10 +84,10 @@ if __name__ == "__main__":
offset = (np.argmax(x)*(150e3 - 10e3)/(9770 - 709))
freq_max = center_frequency + offset + 2000
except: # if no RTL-SDR or in use, stop scanning with high max value and center frequency
max_value = 100
freq_max = center_frequency + 200e3 # should be 434900000
print(f" {freq_max:.0f} {max_value:.0f}")
#print(f"The minimum signal is {min_value} at frequency {freq_min}")
#print(min_value)
#print(max_value)

Loading…
Cancel
Save

Powered by TurnKey Linux.