dmi: apply filter to REF

This commit is contained in:
Sebastien Bourdeauducq 2020-09-27 14:03:13 +08:00
parent cbf9ff439f
commit 6896d28ec2
1 changed files with 8 additions and 2 deletions

10
dmi.py
View File

@ -14,9 +14,15 @@ def main():
freq_sample = 1e6
freq_base = 1088230e3
freq_ref = 1088100e3
block_size = 4096
throttle_factor = ceil(freq_sample/125e3)
# note: image band still goes through
freq_ref_abs = np.abs(freq_ref-freq_base)
ref_filter = LinearPhaseFilter(127, [freq_ref_abs-15e3, freq_ref_abs+15e3], pass_zero=False, fs=freq_sample)
meas_delay = Delay(block_size, ref_filter.delay())
gui = GUI(freq_sample, freq_base, block_size)
try:
induction = InductionHeater("/dev/ttyUSB0", 350e3, 445e3)
@ -26,7 +32,7 @@ def main():
gui.update_ref(spectrum, peak_freq, locked)
induction.set(tuning)
stabilizer = Stabilizer(freq_sample, block_size, 1088.1e6 - freq_base, stabilizer_cb)
stabilizer = Stabilizer(freq_sample, block_size, freq_ref-freq_base, stabilizer_cb)
position_tracker = PositionTracker()
sdr = SoapySDR.Device()
@ -56,7 +62,7 @@ def main():
gui.update_meas(samples_meas)
if stabilizer.locked():
position = position_tracker.input(samples_ref, samples_meas)
position = position_tracker.input(ref_filter.input(samples_ref), meas_delay.input(samples_meas))
position_acc += np.mean(position)
if throttle == 0:
gui.update_position(position_acc/throttle_factor)