mirror of
https://github.com/rtlsdrblog/rtl-sdr-blog.git
synced 2024-11-06 10:47:35 +01:00
use default xtal freq when 0 is given
This commit is contained in:
parent
721085e1ab
commit
cec93754a2
@ -484,14 +484,15 @@ int rtlsdr_set_xtal_freq(rtlsdr_dev_t *dev, uint32_t rtl_freq, uint32_t tuner_fr
|
||||
if (!dev)
|
||||
return -1;
|
||||
|
||||
if (rtl_freq < MIN_RTL_XTAL_FREQ || rtl_freq > MAX_RTL_XTAL_FREQ)
|
||||
if (rtl_freq > 0 &&
|
||||
(rtl_freq < MIN_RTL_XTAL_FREQ || rtl_freq > MAX_RTL_XTAL_FREQ))
|
||||
return -2;
|
||||
|
||||
if (dev->rtl_xtal != rtl_freq) {
|
||||
dev->rtl_xtal = rtl_freq;
|
||||
if (0 == rtl_freq)
|
||||
rtl_freq = DEF_RTL_XTAL_FREQ;
|
||||
|
||||
if (0 == dev->rtl_xtal)
|
||||
dev->rtl_xtal = DEF_RTL_XTAL_FREQ;
|
||||
dev->rtl_xtal = rtl_freq;
|
||||
|
||||
/* update xtal-dependent settings */
|
||||
if (dev->rate)
|
||||
@ -499,12 +500,11 @@ int rtlsdr_set_xtal_freq(rtlsdr_dev_t *dev, uint32_t rtl_freq, uint32_t tuner_fr
|
||||
}
|
||||
|
||||
if (dev->tun_xtal != tuner_freq) {
|
||||
if (0 == tuner_freq)
|
||||
tuner_freq = dev->rtl_xtal;
|
||||
|
||||
dev->tun_xtal = tuner_freq;
|
||||
|
||||
if (0 == dev->tun_xtal)
|
||||
dev->tun_xtal = dev->rtl_xtal;
|
||||
|
||||
/* update xtal-dependent settings */
|
||||
if (dev->freq)
|
||||
r = rtlsdr_set_center_freq(dev, dev->freq);
|
||||
|
Loading…
Reference in New Issue
Block a user