UHD: fix SPP equal 0

master
Xavier Arteaga 5 years ago committed by Xavier Arteaga
parent 774c0926a6
commit 5d43fc903e

@ -149,12 +149,20 @@ public:
uhd_error get_rx_stream(const uhd::stream_args_t& args, size_t& max_num_samps) override
{
UHD_SAFE_C_SAVE_ERROR(this, rx_stream = nullptr; rx_stream = usrp->get_rx_stream(args);
max_num_samps = rx_stream->get_max_num_samps();)
max_num_samps = rx_stream->get_max_num_samps();
if (max_num_samps == 0UL) {
last_error = "The maximum number of receive samples is zero.";
return UHD_ERROR_VALUE;
})
}
uhd_error get_tx_stream(const uhd::stream_args_t& args, size_t& max_num_samps) override
{
UHD_SAFE_C_SAVE_ERROR(this, tx_stream = nullptr; tx_stream = usrp->get_tx_stream(args);
max_num_samps = tx_stream->get_max_num_samps();)
max_num_samps = tx_stream->get_max_num_samps();
if (max_num_samps == 0UL) {
last_error = "The maximum number of transmit samples is zero.";
return UHD_ERROR_VALUE;
})
}
uhd_error set_tx_gain(size_t ch, double gain) override { UHD_SAFE_C_SAVE_ERROR(this, usrp->set_tx_gain(gain, ch);) }
uhd_error set_rx_gain(size_t ch, double gain) override { UHD_SAFE_C_SAVE_ERROR(this, usrp->set_rx_gain(gain, ch);) }

@ -594,7 +594,7 @@ int rf_uhd_open_multi(char* args, void** h, uint32_t nof_channels)
}
// Samples-Per-Packet option, 0 means automatic
std::string spp = "0";
std::string spp;
if (device_addr.has_key("spp")) {
spp = device_addr.pop("spp");
}
@ -809,7 +809,13 @@ int rf_uhd_open_multi(char* args, void** h, uint32_t nof_channels)
// Initialize TX/RX stream args
handler->stream_args.cpu_format = "fc32";
handler->stream_args.otw_format = otw_format;
handler->stream_args.args.set("spp", spp);
if (not spp.empty()) {
if (spp == "0") {
Warning(
"The parameter spp is 0, some UHD versions do not handle it as default and receive method will overflow.");
}
handler->stream_args.args.set("spp", spp);
}
handler->stream_args.channels.resize(nof_channels);
for (size_t i = 0; i < (size_t)nof_channels; i++) {
handler->stream_args.channels[i] = i;

Loading…
Cancel
Save