diff --git a/apps/dvbs2-rec b/apps/dvbs2-rec index ef75d5e..2d9037a 100644 --- a/apps/dvbs2-rec +++ b/apps/dvbs2-rec @@ -114,14 +114,6 @@ class DVBS2RecTopBlock(gr.top_block, Qt.QWidget): self.flowgraph_connected = False self.gui_setup_complete = False - # Adjust the sample rate to an integer if necessary - if self.source == 'plutosdr' and not self.samp_rate.is_integer(): - self.samp_rate = int(round(self.samp_rate)) - gr.log.warn("An integer sample rate is required by the PlutoSDR. " - "Setting rate to {:d} samples/sec.".format( - self.samp_rate)) - self.sym_rate = self.samp_rate / self.sps - ################################################## # Flowgraph ################################################## @@ -372,7 +364,7 @@ class DVBS2RecTopBlock(gr.top_block, Qt.QWidget): iio_pluto_source.set_len_tag_key('packet_len') iio_pluto_source.set_frequency(self.freq) - iio_pluto_source.set_samplerate(self.samp_rate) + iio_pluto_source.set_samplerate(int(self.samp_rate)) iio_pluto_source.set_gain_mode(0, self.plutosdr['gain_mode']) iio_pluto_source.set_gain(0, self.plutosdr['manual_gain']) iio_pluto_source.set_quadrature(True) @@ -828,6 +820,11 @@ def argument_parser(): "argument --bladerf-bw should be greater than {} Hz".format( min_bw)) + samp_rate = (options.samp_rate if options.samp_rate is not None else + options.sps * options.sym_rate) + if (options.source == "plutosdr" and not samp_rate.is_integer()): + parser.error("An integer sample rate is required by the PlutoSDR") + return options diff --git a/apps/dvbs2-rx b/apps/dvbs2-rx index aca65a4..61596ef 100755 --- a/apps/dvbs2-rx +++ b/apps/dvbs2-rx @@ -142,14 +142,6 @@ class DVBS2RxTopBlock(gr.top_block, Qt.QWidget): self.flowgraph_connected = False self.gui_setup_complete = False - # Adjust the sample rate to an integer if necessary - if self.source == 'plutosdr' and not self.samp_rate.is_integer(): - self.samp_rate = int(round(self.samp_rate)) - gr.log.warn("An integer sample rate is required by the PlutoSDR. " - "Setting rate to {:d} samples/sec.".format( - self.samp_rate)) - self.sym_rate = self.samp_rate / self.sps - ################################################## # Flowgraph ################################################## @@ -662,7 +654,7 @@ class DVBS2RxTopBlock(gr.top_block, Qt.QWidget): iio_pluto_source.set_len_tag_key('packet_len') iio_pluto_source.set_frequency(self.freq) - iio_pluto_source.set_samplerate(self.samp_rate) + iio_pluto_source.set_samplerate(int(self.samp_rate)) iio_pluto_source.set_gain_mode(0, self.plutosdr['gain_mode']) iio_pluto_source.set_gain(0, self.plutosdr['manual_gain']) iio_pluto_source.set_quadrature(True) @@ -1563,6 +1555,11 @@ def argument_parser(): "argument --bladerf-bw should be greater than {} Hz".format( min_bw)) + samp_rate = (options.samp_rate if options.samp_rate is not None else + options.sps * options.sym_rate) + if (options.source == "plutosdr" and not samp_rate.is_integer()): + parser.error("An integer sample rate is required by the PlutoSDR") + return options diff --git a/apps/dvbs2-tx b/apps/dvbs2-tx index 3389eab..5859e1a 100755 --- a/apps/dvbs2-tx +++ b/apps/dvbs2-tx @@ -161,14 +161,6 @@ class dvbs2_tx(gr.top_block, Qt.QWidget): self.start_time = datetime.now() self.uptime = datetime.now() - self.start_time - # Adjust the sample rate to an integer if necessary - if self.sink == 'plutosdr' and not self.samp_rate.is_integer(): - self.samp_rate = int(round(self.samp_rate)) - gr.log.warn("An integer sample rate is required by the PlutoSDR. " - "Setting rate to {:d} samples/sec.".format( - self.samp_rate)) - self.sym_rate = self.samp_rate / self.sps - ################################################## # Flowgraph ################################################## @@ -498,7 +490,7 @@ class dvbs2_tx(gr.top_block, Qt.QWidget): iio_pluto_sink.set_bandwidth( 20000000) # TODO confirm if required in auto mode iio_pluto_sink.set_frequency(self.freq) - iio_pluto_sink.set_samplerate(self.samp_rate) + iio_pluto_sink.set_samplerate(int(self.samp_rate)) iio_pluto_sink.set_attenuation(0, self.plutosdr['attenuation']) iio_pluto_sink.set_filter_params('Auto', '', 0, 0) @@ -1003,6 +995,11 @@ def argument_parser(): "argument --bladerf-bw should be greater than {} Hz".format( min_bw)) + samp_rate = (options.samp_rate if options.samp_rate is not None else + options.sps * options.sym_rate) + if (options.sink == "plutosdr" and not samp_rate.is_integer()): + parser.error("An integer sample rate is required by the PlutoSDR") + return options