aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Markgraf <steve@steve-m.de>2012-10-28 15:42:39 +0100
committerSteve Markgraf <steve@steve-m.de>2012-10-28 15:42:39 +0100
commitac05f9084c6bbe764c859dc8d44352dafce5287a (patch)
treee349d8242ee3ef9217e4df005c7c08bda62c0adc
parent3fdea955ca011e47d03dc66b0cdb1c6944a27679 (diff)
make sure offset tuning works with gr-osmosdr
Signed-off-by: Steve Markgraf <steve@steve-m.de>
-rw-r--r--src/librtlsdr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/librtlsdr.c b/src/librtlsdr.c
index c27fdba..0328e9e 100644
--- a/src/librtlsdr.c
+++ b/src/librtlsdr.c
@@ -936,6 +936,10 @@ int rtlsdr_set_sample_rate(rtlsdr_dev_t *dev, uint32_t samp_rate)
r |= rtlsdr_demod_write_reg(dev, 1, 0x01, 0x14, 1);
r |= rtlsdr_demod_write_reg(dev, 1, 0x01, 0x10, 1);
+ /* recalculate offset frequency if offset tuning is enabled */
+ if (dev->offs_freq)
+ rtlsdr_set_offset_tuning(dev, 1);
+
return r;
}
@@ -1056,7 +1060,8 @@ int rtlsdr_set_offset_tuning(rtlsdr_dev_t *dev, int on)
rtlsdr_set_i2c_repeater(dev, 0);
}
- r |= rtlsdr_set_center_freq(dev, dev->freq);
+ if (dev->freq > dev->offs_freq)
+ r |= rtlsdr_set_center_freq(dev, dev->freq);
return r;
}