USRP samplerate selection fix attempt

This commit is contained in:
AlexandreRouma 2023-01-21 00:16:31 +01:00
parent 7a1a37fbf6
commit ab5d7a73c1

View File

@ -137,14 +137,8 @@ public:
samplerates.clear(); samplerates.clear();
auto srList = dev->get_rx_rates(chanId); auto srList = dev->get_rx_rates(chanId);
for (auto& l : srList) { for (auto& l : srList) {
// If a single value, add it to the list double step = (l.step() == 0.0) ? 100e3 : l.step();
if (l.step() == 0.0 || l.start() == l.stop()) { for (double f = l.start(); f <= l.stop(); f += step) {
samplerates.define(l.start(), getBandwdithScaled(l.start()), l.start());
continue;
}
// Otherwise, save all entries to the list
for (double f = l.start(); f <= l.stop(); f += l.step()) {
samplerates.define(f, getBandwdithScaled(f), f); samplerates.define(f, getBandwdithScaled(f), f);
} }
} }
@ -164,7 +158,6 @@ public:
bandwidths.define(0, "Auto", 0); bandwidths.define(0, "Auto", 0);
uhd::meta_range_t bwRange = dev->get_rx_bandwidth_range(chanId); uhd::meta_range_t bwRange = dev->get_rx_bandwidth_range(chanId);
for (const auto& r : bwRange) { for (const auto& r : bwRange) {
// Otherwise, save all entries to the list
double step = (r.step() == 0.0) ? 100e3 : r.step(); double step = (r.step() == 0.0) ? 100e3 : r.step();
for (double i = r.start(); i <= r.stop(); i += step) { for (double i = r.start(); i <= r.stop(); i += step) {
bandwidths.define((int)i, getBandwdithScaled(i), i); bandwidths.define((int)i, getBandwdithScaled(i), i);