Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ppm error frecuency correction in the command line #96

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
8 changes: 6 additions & 2 deletions dump1090.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ struct {
int enable_agc;
rtlsdr_dev_t *dev;
int freq;
int ppm;

/* Networking */
char aneterr[ANET_ERR_LEN];
Expand Down Expand Up @@ -274,6 +275,7 @@ void modesInitConfig(void) {
Modes.interactive_ttl = MODES_INTERACTIVE_TTL;
Modes.aggressive = 0;
Modes.interactive_rows = getTermRows();
Modes.ppm=0;
}

void modesInit(void) {
Expand Down Expand Up @@ -334,7 +336,6 @@ void modesInit(void) {
void modesInitRTLSDR(void) {
int j;
int device_count;
int ppm_error = 0;
char vendor[256], product[256], serial[256];

device_count = rtlsdr_get_device_count();
Expand Down Expand Up @@ -374,7 +375,7 @@ void modesInitRTLSDR(void) {
} else {
fprintf(stderr, "Using automatic gain control.\n");
}
rtlsdr_set_freq_correction(Modes.dev, ppm_error);
rtlsdr_set_freq_correction(Modes.dev, Modes.ppm);
if (Modes.enable_agc) rtlsdr_set_agc_mode(Modes.dev, 1);
rtlsdr_set_center_freq(Modes.dev, Modes.freq);
rtlsdr_set_sample_rate(Modes.dev, MODES_DEFAULT_RATE);
Expand Down Expand Up @@ -2422,6 +2423,7 @@ void showHelp(void) {
"--gain <db> Set gain (default: max gain. Use -100 for auto-gain).\n"
"--enable-agc Enable the Automatic Gain Control (default: off).\n"
"--freq <hz> Set frequency (default: 1090 Mhz).\n"
"--ppm <ppm> Set ppm error (default: 0).\n"
"--ifile <filename> Read data from file (use '-' for stdin).\n"
"--interactive Interactive mode refreshing data on screen.\n"
"--interactive-rows <num> Max number of rows in interactive mode (default: 15).\n"
Expand Down Expand Up @@ -2492,6 +2494,8 @@ int main(int argc, char **argv) {
Modes.enable_agc++;
} else if (!strcmp(argv[j],"--freq") && more) {
Modes.freq = strtoll(argv[++j],NULL,10);
} else if (!strcmp(argv[j],"--ppm") && more) {
Modes.ppm = strtoll(argv[++j],NULL,10);
} else if (!strcmp(argv[j],"--ifile") && more) {
Modes.filename = strdup(argv[++j]);
} else if (!strcmp(argv[j],"--no-fix")) {
Expand Down