Cleanup SDR usage when no channel, but full spectrum is used.
Radio and TV uses full spectrum, so they set channels to 0, this will define a center frequency only. The spectrum is then processed by the applications and not by libsdr. The sample rate must be a factor of 1e9, so that time stamps work and signal has no gaps/glitchs.
This commit is contained in:
parent
726453909c
commit
2d23c841a6
|
@ -167,11 +167,6 @@ void *sdr_open(const char __attribute__((__unused__)) *device, double *tx_freque
|
|||
if (bandwidth)
|
||||
PDEBUG(DSDR, DEBUG_INFO, "Require bandwidth of each channel is 2 * (%.1f deviation + %.1f modulation) = %.1f KHz\n", max_deviation / 1e3, max_modulation / 1e3, bandwidth / 1e3);
|
||||
|
||||
if (channels < 1) {
|
||||
PDEBUG(DSDR, DEBUG_ERROR, "No channel given, please fix!\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
sdr = calloc(sizeof(*sdr), 1);
|
||||
if (!sdr) {
|
||||
PDEBUG(DSDR, DEBUG_ERROR, "NO MEM!\n");
|
||||
|
@ -261,10 +256,12 @@ void *sdr_open(const char __attribute__((__unused__)) *device, double *tx_freque
|
|||
}
|
||||
|
||||
/* create list of channel states */
|
||||
sdr->chan = calloc(sizeof(*sdr->chan), channels + (sdr->paging_channel != 0));
|
||||
if (!sdr->chan) {
|
||||
PDEBUG(DSDR, DEBUG_ERROR, "NO MEM!\n");
|
||||
goto error;
|
||||
if (channels) {
|
||||
sdr->chan = calloc(sizeof(*sdr->chan), channels + (sdr->paging_channel != 0));
|
||||
if (!sdr->chan) {
|
||||
PDEBUG(DSDR, DEBUG_ERROR, "NO MEM!\n");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
/* swap links, if required */
|
||||
|
@ -276,7 +273,9 @@ void *sdr_open(const char __attribute__((__unused__)) *device, double *tx_freque
|
|||
tx_frequency = temp;
|
||||
}
|
||||
|
||||
if (tx_frequency) {
|
||||
if (tx_frequency && !channels)
|
||||
tx_center_frequency = tx_frequency[0];
|
||||
if (tx_frequency && channels) {
|
||||
/* calculate required bandwidth (IQ rate) */
|
||||
|
||||
double tx_low_frequency = 0.0, tx_high_frequency = 0.0;
|
||||
|
@ -357,7 +356,9 @@ void *sdr_open(const char __attribute__((__unused__)) *device, double *tx_freque
|
|||
}
|
||||
}
|
||||
|
||||
if (rx_frequency) {
|
||||
if (rx_frequency && !channels)
|
||||
rx_center_frequency = rx_frequency[0];
|
||||
if (rx_frequency && channels) {
|
||||
/* calculate required bandwidth (IQ rate) */
|
||||
double rx_low_frequency = 0.0, rx_high_frequency = 0.0;
|
||||
for (c = 0; c < channels; c++) {
|
||||
|
|
|
@ -99,7 +99,7 @@ int soapy_open(size_t channel, const char *_device_args, const char *_stream_arg
|
|||
|
||||
use_time_stamps = timestamps;
|
||||
if (use_time_stamps && (1000000000LL % (long long)rate)) {
|
||||
PDEBUG(DSOAPY, DEBUG_ERROR, "The given sample duration is not a multiple of a nano second. I.e. we can't divide 1000,000,000 by sample rate of %.0f. Please choose a different sample rate for time stamp support!\n", rate);
|
||||
PDEBUG(DSOAPY, DEBUG_ERROR, "The given sample duration is not a multiple of a nano second. I.e. we can't divide 10^9 by sample rate of %.0f. Please choose a different sample rate for time stamp support!\n", rate);
|
||||
use_time_stamps = 0;
|
||||
}
|
||||
Ns_per_sample = 1000000000LL / (long long)rate;
|
||||
|
|
|
@ -393,7 +393,7 @@ int main(int argc, char *argv[])
|
|||
tx_frequencies[0] = frequency;
|
||||
rx_frequencies[0] = frequency;
|
||||
am[0] = 0;
|
||||
sdr = sdr_open(NULL, tx_frequencies, rx_frequencies, am, 1, 0.0, dsp_samplerate, buffer_size, 1.0, 0.0, 0.0, 0.0);
|
||||
sdr = sdr_open(NULL, tx_frequencies, rx_frequencies, am, 0, 0.0, dsp_samplerate, buffer_size, 1.0, 0.0, 0.0, 0.0);
|
||||
if (!sdr)
|
||||
goto error;
|
||||
sdr_start(sdr);
|
||||
|
|
|
@ -228,7 +228,7 @@ static int handle_options(int short_option, int argi, char **argv)
|
|||
"--sdr-tx-gain", "50",
|
||||
"--sdr-lo-offset", "-3000000",
|
||||
"--sdr-bandwidth", "60000000",
|
||||
"-s", "13750000",
|
||||
"-s", "12500000",
|
||||
};
|
||||
int argc_lime = sizeof(argv_lime) / sizeof (*argv_lime);
|
||||
return options_command_line(argc_lime, argv_lime, handle_options);
|
||||
|
@ -242,7 +242,7 @@ static int handle_options(int short_option, int argi, char **argv)
|
|||
"--sdr-tx-gain", "50",
|
||||
"--sdr-lo-offset", "-3000000",
|
||||
"--sdr-bandwidth", "60000000",
|
||||
"-s", "13750000",
|
||||
"-s", "12500000",
|
||||
};
|
||||
int argc_lime = sizeof(argv_lime) / sizeof (*argv_lime);
|
||||
return options_command_line(argc_lime, argv_lime, handle_options);
|
||||
|
@ -333,7 +333,7 @@ static void tx_bas(sample_t *sample_bas, __attribute__((__unused__)) sample_t *s
|
|||
tx_frequencies[0] = frequency;
|
||||
rx_frequencies[0] = frequency;
|
||||
am[0] = 0;
|
||||
sdr = sdr_open(NULL, tx_frequencies, rx_frequencies, am, 1, 0.0, dsp_samplerate, buffer_size, 1.0, 0.0, 0.0, 0.0);
|
||||
sdr = sdr_open(NULL, tx_frequencies, rx_frequencies, am, 0, 0.0, dsp_samplerate, buffer_size, 1.0, 0.0, 0.0, 0.0);
|
||||
if (!sdr)
|
||||
goto error;
|
||||
sdr_start(sdr);
|
||||
|
|
Loading…
Reference in New Issue