You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

47 lines
1.5 KiB

import SoapySDR
import numpy as np
from scipy.signal import blackmanharris
from stabilizer import InductionHeater, Stabilizer
def main():
freq_sample = 5e6
freq_base = 1086e6
induction = InductionHeater("/dev/ttyUSB0", 430e3, 445e3)
induction.start()
try:
stabilizer = Stabilizer(freq_sample, 0.4, 1088.3e6 - freq_base, 200e-6, induction)
sdr = SoapySDR.Device()
sdr.setSampleRate(SoapySDR.SOAPY_SDR_RX, 0, freq_sample)
sdr.setFrequency(SoapySDR.SOAPY_SDR_RX, 0, base_freq)
samples = np.array([0]*4096, np.complex64)
rx_stream = sdr.setupStream(SoapySDR.SOAPY_SDR_RX, SoapySDR.SOAPY_SDR_CF32)
try:
sdr.activateStream(rx_stream)
try:
# We can't update faster than the MHS5200A serial interface
stabilizer_throttle = 0
while True:
sr = sdr.readStream(rx_stream, [samples], len(samples))
if sr.ret != len(samples):
print("SDR sampling error")
return
stabilizer_throttle += 1
if stabilizer_throttle == 30:
stabilizer.input(samples)
stabilizer_throttle = 0
finally:
sdr.deactivateStream(rx_stream)
finally:
sdr.closeStream(rx_stream)
finally:
induction.stop()
if __name__ == "__main__":
main()