merged trondeau/digital-wip2 r4193:4730 into trunk - improves digital receiver and...
[debian/gnuradio] / gnuradio-examples / python / digital / receive_path.py
index 9d55c88ddbb1011826f556b05700bb883c0d9a54..03e623f9fd5cdf39aad1cf1ae3a10f6454a3bb81 100644 (file)
@@ -57,7 +57,22 @@ class receive_path(gr.hier_block):
 
         # Set up USRP source; also adjusts decim, samples_per_symbol, and bitrate
         self._setup_usrp_source()
-        
+
+        g = self.subdev.gain_range()
+        if options.show_rx_gain_range:
+            print "Rx Gain Range: minimum = %g, maximum = %g, step size = %g" \
+                  % (g[0], g[1], g[2])
+
+        self.set_gain(options.rx_gain)
+
+        self.set_auto_tr(True)                 # enable Auto Transmit/Receive switching
+
+        # Set RF frequency
+        ok = self.set_freq(self._rx_freq)
+        if not ok:
+            print "Failed to set Rx frequency to %s" % (eng_notation.num_to_str(self._rx_freq))
+            raise ValueError, eng_notation.num_to_str(self._rx_freq)
+
         # copy the final answers back into options for use by demodulator
         options.samples_per_symbol = self._samples_per_symbol
         options.bitrate = self._bitrate
@@ -71,7 +86,7 @@ class receive_path(gr.hier_block):
         chan_coeffs = gr.firdes.low_pass (1.0,                  # gain
                                           sw_decim * self._samples_per_symbol, # sampling rate
                                           1.0,                  # midpoint of trans. band
-                                          0.1,                  # width of trans. band
+                                          0.5,                  # width of trans. band
                                           gr.firdes.WIN_HANN)   # filter type 
 
         # Decimating channel filter
@@ -86,21 +101,7 @@ class receive_path(gr.hier_block):
                             access_code=None,
                             callback=self._rx_callback,
                             threshold=-1)
-
-        ok = self.set_freq(self._rx_freq)
-        if not ok:
-            print "Failed to set Rx frequency to %s" % (eng_notation.num_to_str(self._rx_freq))
-            raise ValueError, eng_notation.num_to_str(self._rx_freq)
     
-        g = self.subdev.gain_range()
-        if options.show_rx_gain_range:
-            print "Rx Gain Range: minimum = %g, maximum = %g, step size = %g" \
-                  % (g[0], g[1], g[2])
-
-        self.set_gain(options.rx_gain)
-
-        self.set_auto_tr(True)                 # enable Auto Transmit/Receive switching
-
         # Carrier Sensing Blocks
         alpha = 0.001
         thresh = 30   # in dB, will have to adjust
@@ -228,6 +229,7 @@ class receive_path(gr.hier_block):
         """
         Prints information about the receive path
         """
+        print "\nReceive Path:"
         print "Using RX d'board %s"    % (self.subdev.side_and_name(),)
         print "Rx gain:         %g"    % (self.gain,)
         print "modulation:      %s"    % (self._demod_class.__name__)