diff --git a/include/dsd.h b/include/dsd.h index 3dc6949..1171d75 100644 --- a/include/dsd.h +++ b/include/dsd.h @@ -89,6 +89,7 @@ typedef struct PaStream* audio_in_pa_stream; #endif uint32_t rtlsdr_center_freq; + int rtlsdr_ppm_error; int audio_in_type; // 0 for device, 1 for file, 2 for portaudio, 3 for rtlsdr char audio_out_dev[1024]; int audio_out_fd; diff --git a/src/dsd_main.c b/src/dsd_main.c index 5231cd3..075175e 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -275,6 +275,7 @@ usage () printf (" -w Output synthesized speech to a .wav file\n"); printf (" -a Display port audio devices\n"); printf (" -c RTL-SDR center frequency\n"); + printf (" -P RTL-SDR ppm error (default = 0)\n"); printf ("\n"); printf ("Scanner control options:\n"); printf (" -B Serial port baud rate (default=115200)\n"); @@ -513,7 +514,7 @@ main (int argc, char **argv) exitflag = 0; signal (SIGINT, sigfun); - while ((c = getopt (argc, argv, "haep:qstv:z:i:o:d:c:g:nw:B:C:R:f:m:u:x:A:S:M:rl")) != -1) + while ((c = getopt (argc, argv, "haep:P:qstv:z:i:o:d:c:g:nw:B:C:R:f:m:u:x:A:S:M:rl")) != -1) { opterr = 0; switch (c) @@ -550,6 +551,9 @@ main (int argc, char **argv) opts.unmute_encrypted_p25 = 1; } break; + case 'P': + sscanf (optarg, "%i", &opts.rtlsdr_ppm_error); + break; case 'q': opts.errorbars = 0; opts.verbose = 0; diff --git a/src/rtl_sdr_fm.cpp b/src/rtl_sdr_fm.cpp index ea4e190..b8b6cb5 100644 --- a/src/rtl_sdr_fm.cpp +++ b/src/rtl_sdr_fm.cpp @@ -901,6 +901,10 @@ void open_rtlsdr_stream(dsd_opts *opts) controller.freq_len++; } + if (opts->rtlsdr_ppm_error > 0) { + dongle.ppm_error = opts->rtlsdr_ppm_error; + } + /* quadruple sample_rate to limit to Δθ to ±π/2 */ demod.rate_in *= demod.post_downsample;