Browse Source

rearrange blocks; rename variable `down_rate_hertz` to `channel_width_hertz`

Fabian Peter Hammerle 3 years ago
parent
commit
e0b01f2d88
2 changed files with 35 additions and 36 deletions
  1. 22 22
      fm_radio.grc
  2. 13 14
      fm_radio.py

+ 22 - 22
fm_radio.grc

@@ -1,6 +1,6 @@
 options:
   parameters:
-    author: fabianpeter
+    author: ''
     category: '[GRC Hier Blocks]'
     cmake_opt: ''
     comment: ''
@@ -21,18 +21,18 @@ options:
     run_options: prompt
     sizing_mode: fixed
     thread_safe_setters: ''
-    title: Not titled yet
+    title: FM Radio Receiver
     window_size: ''
   states:
     bus_sink: false
     bus_source: false
     bus_structure: null
-    coordinate: [67, 22]
+    coordinate: [32, 34]
     rotation: 0
     state: enabled
 
 blocks:
-- name: down_rate_hertz
+- name: channel_width_hertz
   id: variable
   parameters:
     comment: ''
@@ -41,7 +41,7 @@ blocks:
     bus_sink: false
     bus_source: false
     bus_structure: null
-    coordinate: [951, 44]
+    coordinate: [705, 156]
     rotation: 0
     state: true
 - name: frequency_mhz
@@ -62,7 +62,7 @@ blocks:
     bus_sink: false
     bus_source: false
     bus_structure: null
-    coordinate: [528, 22]
+    coordinate: [405, 36]
     rotation: 0
     state: true
 - name: samp_rate
@@ -74,7 +74,7 @@ blocks:
     bus_sink: false
     bus_source: false
     bus_structure: null
-    coordinate: [947, 163]
+    coordinate: [33, 182]
     rotation: 0
     state: enabled
 - name: volume
@@ -95,7 +95,7 @@ blocks:
     bus_sink: false
     bus_source: false
     bus_structure: null
-    coordinate: [1312, 52]
+    coordinate: [1551, 545]
     rotation: 0
     state: true
 - name: analog_wfm_rcv_0
@@ -107,12 +107,12 @@ blocks:
     comment: ''
     maxoutbuf: '0'
     minoutbuf: '0'
-    quad_rate: down_rate_hertz
+    quad_rate: channel_width_hertz
   states:
     bus_sink: false
     bus_source: false
     bus_structure: null
-    coordinate: [1018, 596]
+    coordinate: [1087, 261]
     rotation: 0
     state: enabled
 - name: audio_sink_0
@@ -129,8 +129,8 @@ blocks:
     bus_sink: false
     bus_source: false
     bus_structure: null
-    coordinate: [2025, 758]
-    rotation: 0
+    coordinate: [1178, 479]
+    rotation: 180
     state: enabled
 - name: blocks_multiply_const_vxx_0
   id: blocks_multiply_const_vxx
@@ -147,8 +147,8 @@ blocks:
     bus_sink: false
     bus_source: false
     bus_structure: null
-    coordinate: [1735, 527]
-    rotation: 0
+    coordinate: [1582, 479]
+    rotation: 180
     state: true
 - name: low_pass_filter_0
   id: low_pass_filter
@@ -158,7 +158,7 @@ blocks:
     beta: '6.76'
     comment: https://de.wikipedia.org/wiki/Datei:UKW-Rundfunk-Basisband.svg
     cutoff_freq: '100000'
-    decim: int(samp_rate/down_rate_hertz)
+    decim: int(samp_rate/channel_width_hertz)
     gain: '2'
     interp: '1'
     maxoutbuf: '0'
@@ -171,7 +171,7 @@ blocks:
     bus_sink: false
     bus_source: false
     bus_structure: null
-    coordinate: [612, 520]
+    coordinate: [669, 283]
     rotation: 0
     state: true
 - name: qtgui_freq_sink_x_0
@@ -192,7 +192,7 @@ blocks:
     autoscale: 'False'
     average: '1.0'
     axislabels: 'True'
-    bw: down_rate_hertz
+    bw: channel_width_hertz
     color1: '"blue"'
     color10: '"dark blue"'
     color2: '"red"'
@@ -251,7 +251,7 @@ blocks:
     bus_sink: false
     bus_source: false
     bus_structure: null
-    coordinate: [1473, 330]
+    coordinate: [1559, 111]
     rotation: 0
     state: true
 - name: qtgui_waterfall_sink_x_0
@@ -312,7 +312,7 @@ blocks:
     bus_sink: false
     bus_source: false
     bus_structure: null
-    coordinate: [659, 339]
+    coordinate: [676, 559]
     rotation: 0
     state: true
 - name: rational_resampler_xxx_0
@@ -321,7 +321,7 @@ blocks:
     affinity: ''
     alias: ''
     comment: ''
-    decim: down_rate_hertz
+    decim: channel_width_hertz
     fbw: '0'
     interp: '48000'
     maxoutbuf: '0'
@@ -332,7 +332,7 @@ blocks:
     bus_sink: false
     bus_source: false
     bus_structure: null
-    coordinate: [1419, 699]
+    coordinate: [1560, 289]
     rotation: 0
     state: true
 - name: rtlsdr_source_0
@@ -697,7 +697,7 @@ blocks:
     bus_sink: false
     bus_source: false
     bus_structure: null
-    coordinate: [23, 345]
+    coordinate: [31, 290]
     rotation: 0
     state: true
 

+ 13 - 14
fm_radio.py

@@ -5,8 +5,7 @@
 # SPDX-License-Identifier: GPL-3.0
 #
 # GNU Radio Python Flow Graph
-# Title: Not titled yet
-# Author: fabianpeter
+# Title: FM Radio Receiver
 # GNU Radio version: 3.8.1.0
 
 from distutils.version import StrictVersion
@@ -43,9 +42,9 @@ from gnuradio import qtgui
 class fm_radio(gr.top_block, Qt.QWidget):
 
     def __init__(self):
-        gr.top_block.__init__(self, "Not titled yet")
+        gr.top_block.__init__(self, "FM Radio Receiver")
         Qt.QWidget.__init__(self)
-        self.setWindowTitle("Not titled yet")
+        self.setWindowTitle("FM Radio Receiver")
         qtgui.util.check_set_qss()
         try:
             self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
@@ -79,7 +78,7 @@ class fm_radio(gr.top_block, Qt.QWidget):
         self.volume = volume = 0.5
         self.samp_rate = samp_rate = 2560000
         self.frequency_mhz = frequency_mhz = 98.3
-        self.down_rate_hertz = down_rate_hertz = 250000
+        self.channel_width_hertz = channel_width_hertz = 250000
 
         ##################################################
         # Blocks
@@ -104,7 +103,7 @@ class fm_radio(gr.top_block, Qt.QWidget):
         self.rtlsdr_source_0.set_bandwidth(0, 0)
         self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                 interpolation=48000,
-                decimation=down_rate_hertz,
+                decimation=channel_width_hertz,
                 taps=None,
                 fractional_bw=None)
         self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
@@ -144,7 +143,7 @@ class fm_radio(gr.top_block, Qt.QWidget):
             1024, #size
             firdes.WIN_BLACKMAN_hARRIS, #wintype
             0, #fc
-            down_rate_hertz, #bw
+            channel_width_hertz, #bw
             "Demod Out", #name
             1
         )
@@ -183,7 +182,7 @@ class fm_radio(gr.top_block, Qt.QWidget):
         self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
         self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win)
         self.low_pass_filter_0 = filter.fir_filter_ccf(
-            int(samp_rate/down_rate_hertz),
+            int(samp_rate/channel_width_hertz),
             firdes.low_pass(
                 2,
                 samp_rate,
@@ -194,7 +193,7 @@ class fm_radio(gr.top_block, Qt.QWidget):
         self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(volume)
         self.audio_sink_0 = audio.sink(48000, '', True)
         self.analog_wfm_rcv_0 = analog.wfm_rcv(
-        	quad_rate=down_rate_hertz,
+        	quad_rate=channel_width_hertz,
         	audio_decimation=1,
         )
 
@@ -240,12 +239,12 @@ class fm_radio(gr.top_block, Qt.QWidget):
         self.qtgui_waterfall_sink_x_0.set_frequency_range(self.frequency_mhz*1e6, self.samp_rate)
         self.rtlsdr_source_0.set_center_freq(self.frequency_mhz*1e6, 0)
 
-    def get_down_rate_hertz(self):
-        return self.down_rate_hertz
+    def get_channel_width_hertz(self):
+        return self.channel_width_hertz
 
-    def set_down_rate_hertz(self, down_rate_hertz):
-        self.down_rate_hertz = down_rate_hertz
-        self.qtgui_freq_sink_x_0.set_frequency_range(0, self.down_rate_hertz)
+    def set_channel_width_hertz(self, channel_width_hertz):
+        self.channel_width_hertz = channel_width_hertz
+        self.qtgui_freq_sink_x_0.set_frequency_range(0, self.channel_width_hertz)