1313from gnuradio import audio
1414from gnuradio import blocks
1515import pmt
16- from gnuradio import gr
16+ from gnuradio import filter
1717from gnuradio .filter import firdes
18+ from gnuradio import gr
1819from gnuradio .fft import window
1920import sys
2021import signal
@@ -60,7 +61,7 @@ def __init__(self, message_str='TEST', mult_amp=0.5, tx_cr=1, tx_rx_bw=8000, tx_
6061 samp_rate = samp_rate ,
6162 sf = tx_rx_sf ,
6263 ldro_mode = 2 ,frame_zero_padd = 1280 ,sync_word = tx_rx_sync_word )
63- self .lora_rx_0 = lora_sdr .lora_sdr_lora_rx ( bw = tx_rx_bw , cr = 1 , has_crc = True , impl_head = False , pay_len = 255 , samp_rate = samp_rate , sf = tx_rx_sf , sync_word = tx_rx_sync_word , soft_decoding = True , ldro_mode = 2 , print_rx = [True ,True ])
64+ self .lora_rx_0 = lora_sdr .lora_sdr_lora_rx ( bw = tx_rx_bw , cr = 1 , has_crc = True , impl_head = False , pay_len = 255 , samp_rate = samp_rate , sf = tx_rx_sf , sync_word = tx_rx_sync_word , soft_decoding = True , ldro_mode = 2 , print_rx = [False ,True ])
6465 self .blocks_wavfile_sink_0 = blocks .wavfile_sink (
6566 wav_file_path ,
6667 1 ,
@@ -77,6 +78,16 @@ def __init__(self, message_str='TEST', mult_amp=0.5, tx_cr=1, tx_rx_bw=8000, tx_
7778 self .blocks_conjugate_cc_0 = blocks .conjugate_cc ()
7879 self .blocks_complex_to_float_1 = blocks .complex_to_float (1 )
7980 self .blocks_complex_to_float_0 = blocks .complex_to_float (1 )
81+ self .band_pass_filter_0 = filter .fir_filter_ccf (
82+ 1 ,
83+ firdes .band_pass (
84+ 1 ,
85+ samp_rate ,
86+ (tx_rx_mix_freq - (tx_rx_bw / 2 ) - 1000 ),
87+ (tx_rx_mix_freq + (tx_rx_bw / 2 ) + 1000 ),
88+ 1000 ,
89+ window .WIN_HAMMING ,
90+ 6.76 ))
8091 self .audio_source_0 = audio .source (samp_rate , 'hw:3,0' , True )
8192 self .audio_sink_0 = audio .sink (samp_rate , 'hw:3,0' , True )
8293 self .analog_sig_source_x_0_0 = analog .sig_source_c (samp_rate , analog .GR_COS_WAVE , tx_rx_mix_freq , 1 , 0 , 0 )
@@ -90,10 +101,11 @@ def __init__(self, message_str='TEST', mult_amp=0.5, tx_cr=1, tx_rx_bw=8000, tx_
90101 self .connect ((self .analog_sig_source_x_0 , 0 ), (self .blocks_multiply_xx_0 , 1 ))
91102 self .connect ((self .analog_sig_source_x_0_0 , 0 ), (self .blocks_multiply_xx_0_0 , 0 ))
92103 self .connect ((self .audio_source_0 , 0 ), (self .blocks_float_to_complex_0 , 0 ))
104+ self .connect ((self .band_pass_filter_0 , 0 ), (self .blocks_multiply_xx_0 , 0 ))
93105 self .connect ((self .blocks_complex_to_float_0 , 0 ), (self .audio_sink_0 , 0 ))
94106 self .connect ((self .blocks_complex_to_float_1 , 0 ), (self .blocks_wavfile_sink_0 , 0 ))
95107 self .connect ((self .blocks_conjugate_cc_0 , 0 ), (self .blocks_complex_to_float_0 , 0 ))
96- self .connect ((self .blocks_float_to_complex_0 , 0 ), (self .blocks_multiply_xx_0 , 0 ))
108+ self .connect ((self .blocks_float_to_complex_0 , 0 ), (self .band_pass_filter_0 , 0 ))
97109 self .connect ((self .blocks_multiply_const_vxx_0 , 0 ), (self .blocks_conjugate_cc_0 , 0 ))
98110 self .connect ((self .blocks_multiply_xx_0 , 0 ), (self .blocks_complex_to_float_1 , 0 ))
99111 self .connect ((self .blocks_multiply_xx_0 , 0 ), (self .lora_rx_0 , 0 ))
@@ -126,6 +138,7 @@ def get_tx_rx_bw(self):
126138
127139 def set_tx_rx_bw (self , tx_rx_bw ):
128140 self .tx_rx_bw = tx_rx_bw
141+ self .band_pass_filter_0 .set_taps (firdes .band_pass (1 , self .samp_rate , (self .tx_rx_mix_freq - (self .tx_rx_bw / 2 ) - 1000 ), (self .tx_rx_mix_freq + (self .tx_rx_bw / 2 ) + 1000 ), 1000 , window .WIN_HAMMING , 6.76 ))
129142
130143 def get_tx_rx_mix_freq (self ):
131144 return self .tx_rx_mix_freq
@@ -134,6 +147,7 @@ def set_tx_rx_mix_freq(self, tx_rx_mix_freq):
134147 self .tx_rx_mix_freq = tx_rx_mix_freq
135148 self .analog_sig_source_x_0 .set_frequency ((- self .tx_rx_mix_freq ))
136149 self .analog_sig_source_x_0_0 .set_frequency (self .tx_rx_mix_freq )
150+ self .band_pass_filter_0 .set_taps (firdes .band_pass (1 , self .samp_rate , (self .tx_rx_mix_freq - (self .tx_rx_bw / 2 ) - 1000 ), (self .tx_rx_mix_freq + (self .tx_rx_bw / 2 ) + 1000 ), 1000 , window .WIN_HAMMING , 6.76 ))
137151
138152 def get_tx_rx_sf (self ):
139153 return self .tx_rx_sf
@@ -162,6 +176,7 @@ def set_samp_rate(self, samp_rate):
162176 self .samp_rate = samp_rate
163177 self .analog_sig_source_x_0 .set_sampling_freq (self .samp_rate )
164178 self .analog_sig_source_x_0_0 .set_sampling_freq (self .samp_rate )
179+ self .band_pass_filter_0 .set_taps (firdes .band_pass (1 , self .samp_rate , (self .tx_rx_mix_freq - (self .tx_rx_bw / 2 ) - 1000 ), (self .tx_rx_mix_freq + (self .tx_rx_bw / 2 ) + 1000 ), 1000 , window .WIN_HAMMING , 6.76 ))
165180
166181
167182
0 commit comments