mirror of https://github.com/drowe67/librtlsdr.git
bugfix: avoid printing "PLL not locked" when frequency is not initialized
* see https://github.com/librtlsdr/librtlsdr/issues/57 * it's necessary to remember the rf_frequency, from last r82xx_set_freq() call Signed-off-by: hayati ayguen <h_ayguen@web.de>development
parent
dc1e5a1618
commit
220d41c55f
|
@ -83,8 +83,10 @@ struct r82xx_priv {
|
|||
uint8_t override_mask[NUM_REGS];
|
||||
enum r82xx_xtal_cap_value xtal_cap_sel;
|
||||
uint16_t pll; /* kHz */
|
||||
uint32_t int_freq;
|
||||
int32_t if_band_center_freq;
|
||||
uint32_t rf_freq; /* frequency from r82xx_set_freq() */
|
||||
uint32_t int_freq; /* if frequency at which to deliver towards RTL2832U */
|
||||
int32_t if_band_center_freq; /* frequency relative to zero IF,
|
||||
* on which the band center shall be positioned */
|
||||
uint8_t fil_cal_code;
|
||||
uint8_t input;
|
||||
int has_lock;
|
||||
|
|
|
@ -704,6 +704,7 @@ static int r82xx_set_mux(struct r82xx_priv *priv, uint32_t freq)
|
|||
|
||||
static int r82xx_set_pll(struct r82xx_priv *priv, uint32_t freq)
|
||||
{
|
||||
/* freq == tuner's LO frequency */
|
||||
int rc, i;
|
||||
uint64_t vco_freq;
|
||||
uint64_t vco_div;
|
||||
|
@ -847,10 +848,16 @@ static int r82xx_set_pll(struct r82xx_priv *priv, uint32_t freq)
|
|||
}
|
||||
|
||||
if (!(data[2] & 0x40)) {
|
||||
fprintf(stderr, "[R82XX] PLL not locked for %u Hz!\n", freq);
|
||||
if ( priv->rf_freq )
|
||||
fprintf(stderr, "[R82XX] PLL not locked at Tuner LO %u Hz for RF %u Hz!\n",
|
||||
freq, priv->rf_freq);
|
||||
priv->has_lock = 0;
|
||||
return 0;
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
fprintf(stderr, "[R82XX] PLL locked at Tuner LO %u Hz for RF %u Hz!\n", freq, priv->rf_freq);
|
||||
#endif
|
||||
|
||||
priv->has_lock = 1;
|
||||
|
||||
|
@ -1566,6 +1573,8 @@ int r82xx_set_freq(struct r82xx_priv *priv, uint32_t freq)
|
|||
else
|
||||
lo_freq = freq + priv->int_freq + priv->if_band_center_freq;
|
||||
|
||||
priv->rf_freq = freq;
|
||||
|
||||
#if 0
|
||||
fprintf(stderr, "%s(freq = %u) @ %s--> intfreq %u, ifcenter %d --> f %u\n"
|
||||
, __FUNCTION__, (unsigned)freq, (priv->sideband ? "USB" : "LSB")
|
||||
|
@ -1660,6 +1669,7 @@ int r82xx_init(struct r82xx_priv *priv)
|
|||
/* TODO: R828D might need r82xx_xtal_check() */
|
||||
priv->xtal_cap_sel = XTAL_HIGH_CAP_0P;
|
||||
|
||||
priv->rf_freq = 0;
|
||||
priv->if_band_center_freq = 0;
|
||||
|
||||
priv->last_if_mode = 0;
|
||||
|
|
Loading…
Reference in New Issue