Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions air.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,26 @@ static unsigned int chooseFc(unsigned int minF,unsigned int maxF,int filter)
int i,j;

if(filter) {
/* The reasoning and research for this is described here:
* https://tleconte.github.io/R820T/r820IF.html */

for(i=7;i>=0;i--)
if((r820t_hf[5]-r820t_lf[i])>=bw) break;

if(i<0) return 0;
if(i<0) {
fprintf(stderr, "Unable to use airspy R820T filter optimization, continuing.\n");
} else {
fprintf(stderr, "Enabling airspy R820T filter optimization.\n");

for(j=5;j>=0;j--)
if((r820t_hf[j]-r820t_lf[i])<=bw) break;
j++;
for(j=5;j>=0;j--)
if((r820t_hf[j]-r820t_lf[i])<=bw) break;
j++;

off=(r820t_hf[j]+r820t_lf[i])/2-AIRINRATE/4;
off=(r820t_hf[j]+r820t_lf[i])/2-AIRINRATE/4;

airspy_r820t_write(device, 10, 0xB0 | (15-j));
airspy_r820t_write(device, 11, 0xE0 | (15-i));
airspy_r820t_write(device, 10, 0xB0 | (15-j));
airspy_r820t_write(device, 11, 0xE0 | (15-i));
}
}

return(((maxF+minF)/2+off+INTRATE/2)/INTRATE*INTRATE);
Expand Down