limesdr: add ability to set LPF bandwidth
Add ability to set LPF bandwidth via input command line options.
By default the bandwidth is equal to the default sample rate 2.4 MHz.
Test: connect LimeSDR device, try to set different bandwidth and check
logs:
$ ./dump1090 --device-type limesdr --limesdr-lpfbw 2500000
$ ./dump1090 --device-type limesdr --limesdr-lpfbw 500000
Signed-off-by: Gluttton <gluttton@ukr.net>
This commit is contained in:
parent
c32ed2866e
commit
95ae1a92be
|
|
@ -60,6 +60,7 @@ static struct {
|
||||||
char verbosity;
|
char verbosity;
|
||||||
size_t oversample;
|
size_t oversample;
|
||||||
float gain;
|
float gain;
|
||||||
|
float lpfbw;
|
||||||
lms_info_str_t serial;
|
lms_info_str_t serial;
|
||||||
int bytes_in_sample;
|
int bytes_in_sample;
|
||||||
iq_convert_fn converter;
|
iq_convert_fn converter;
|
||||||
|
|
@ -102,6 +103,7 @@ void limesdrInitConfig()
|
||||||
LimeSDR.verbosity = LMS_LOG_INFO;
|
LimeSDR.verbosity = LMS_LOG_INFO;
|
||||||
LimeSDR.oversample = 0; // default oversample
|
LimeSDR.oversample = 0; // default oversample
|
||||||
LimeSDR.gain = 0.75;
|
LimeSDR.gain = 0.75;
|
||||||
|
LimeSDR.lpfbw = 2400000.0;
|
||||||
LimeSDR.serial[0] = '\0';
|
LimeSDR.serial[0] = '\0';
|
||||||
LimeSDR.bytes_in_sample = 2 * sizeof(int16_t); // hardcoded for LMS_FMT_I16
|
LimeSDR.bytes_in_sample = 2 * sizeof(int16_t); // hardcoded for LMS_FMT_I16
|
||||||
|
|
||||||
|
|
@ -117,6 +119,7 @@ void limesdrShowHelp()
|
||||||
printf("--limesdr-channel set number of an RX channel\n");
|
printf("--limesdr-channel set number of an RX channel\n");
|
||||||
printf("--limesdr-oversample set RF oversampling ratio\n");
|
printf("--limesdr-oversample set RF oversampling ratio\n");
|
||||||
printf("--limesdr-gain set normalized gain\n");
|
printf("--limesdr-gain set normalized gain\n");
|
||||||
|
printf("--limesdr-lpfbw set LPF bandwidth\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -135,6 +138,8 @@ bool limesdrHandleOption(int argc, char **argv, int *jptr)
|
||||||
LimeSDR.oversample = atoi(argv[++j]);
|
LimeSDR.oversample = atoi(argv[++j]);
|
||||||
} else if (!strcmp(argv[j], "--limesdr-gain") && more) {
|
} else if (!strcmp(argv[j], "--limesdr-gain") && more) {
|
||||||
LimeSDR.gain = atof(argv[++j]);
|
LimeSDR.gain = atof(argv[++j]);
|
||||||
|
} else if (!strcmp(argv[j], "--limesdr-lpfbw") && more) {
|
||||||
|
LimeSDR.lpfbw = atof(argv[++j]);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -218,7 +223,7 @@ bool limesdrOpen(void)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LMS_SetLPFBW(LimeSDR.dev, LMS_CH_RX, LimeSDR.stream.channel, Modes.sample_rate)) {
|
if (LMS_SetLPFBW(LimeSDR.dev, LMS_CH_RX, LimeSDR.stream.channel, LimeSDR.lpfbw)) {
|
||||||
limesdrLogHandler(LMS_LOG_ERROR, "unable to set LP filter");
|
limesdrLogHandler(LMS_LOG_ERROR, "unable to set LP filter");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue