uhf appears to work better for ads-b

Signed-off-by: Steve Markgraf <steve@steve-m.de>
master
Hoernchen 13 years ago committed by Steve Markgraf
parent 259e61fb17
commit b6652f33df
  1. 35
      src/tuner_e4k.c

@ -167,20 +167,29 @@ static int closest_arr_idx(const uint32_t *arr, unsigned int arr_size, uint32_t
} }
/* return 4-bit index as to which RF filter to select */ /* return 4-bit index as to which RF filter to select */
static int choose_rf_filter(uint32_t freq) static int choose_rf_filter(enum e4k_band band, uint32_t freq)
{ {
int rc; int rc;
if (freq < MHZ(350)) switch (band) {
rc = 0; case E4K_BAND_VHF2:
else if (freq < MHZ(1000)) case E4K_BAND_VHF3:
rc = closest_arr_idx(rf_filt_center_uhf, rc = 0;
ARRAY_SIZE(rf_filt_center_uhf), break;
freq); case E4K_BAND_UHF:
else rc = closest_arr_idx(rf_filt_center_uhf,
rc = closest_arr_idx(rf_filt_center_l, ARRAY_SIZE(rf_filt_center_uhf),
ARRAY_SIZE(rf_filt_center_l), freq);
freq); break;
case E4K_BAND_L:
rc = closest_arr_idx(rf_filt_center_l,
ARRAY_SIZE(rf_filt_center_l),
freq);
break;
default:
rc -EINVAL;
break;
}
return rc; return rc;
} }
@ -190,7 +199,7 @@ int e4k_rf_filter_set(struct e4k_state *e4k)
{ {
int rc; int rc;
rc = choose_rf_filter(e4k->vco.flo); rc = choose_rf_filter(e4k->band, e4k->vco.flo);
if (rc < 0) if (rc < 0)
return rc; return rc;
@ -525,7 +534,7 @@ int e4k_tune_params(struct e4k_state *e4k, struct e4k_pll_params *p)
e4k_band_set(e4k, E4K_BAND_VHF2); e4k_band_set(e4k, E4K_BAND_VHF2);
else if (e4k->vco.flo < MHZ(350)) else if (e4k->vco.flo < MHZ(350))
e4k_band_set(e4k, E4K_BAND_VHF3); e4k_band_set(e4k, E4K_BAND_VHF3);
else if (e4k->vco.flo < MHZ(1000)) else if (e4k->vco.flo < MHZ(1135))
e4k_band_set(e4k, E4K_BAND_UHF); e4k_band_set(e4k, E4K_BAND_UHF);
else else
e4k_band_set(e4k, E4K_BAND_L); e4k_band_set(e4k, E4K_BAND_L);

Loading…
Cancel
Save