add new patreon to credits + fix USRP samplerate formatting

This commit is contained in:
AlexandreRouma 2025-02-06 15:46:46 +01:00
parent 0e77a9f4ab
commit d020640b7c
3 changed files with 23 additions and 29 deletions

View File

@ -77,9 +77,10 @@ namespace sdrpp_credits {
"Kezza",
"Krys Kamieniecki",
"Lee Donaghy",
"Lee KD1SQ",
"Lee (KD1SQ)",
".lozenge. (Hank Hill)",
"Martin Herren (HB9FXX)",
"Nitin (VU2JEK)",
"ON4MU",
"Passion-Radio.com",
"Paul Maine",

View File

@ -448,9 +448,10 @@ For code changes, please create a feature request instead.
* Kezza
* Krys Kamieniecki
* Lee Donaghy
* Lee KD1SQ
* Lee (KD1SQ)
* .lozenge. (Hank Hill)
* Martin Herren (HB9FXX)
* Nitin (VU2JEK)
* ON4MU
* [Passion-Radio.com](https://passion-radio.com/)
* Paul Maine

View File

@ -11,6 +11,7 @@
#include <uhd/device.hpp>
#include <uhd/usrp/multi_usrp.hpp>
#include <utils/optionlist.h>
#include <utils/freq_formatting.h>
#define CONCAT(a, b) ((std::string(a) + b).c_str())
@ -143,7 +144,7 @@ public:
for (const auto& l : srList) {
double step = (l.step() == 0.0) ? 100e3 : l.step();
for (double f = l.start(); f <= l.stop(); f += step) {
samplerates.define(f, getBandwdithScaled(f), f);
samplerates.define(f, utils::formatFreq(f), f);
}
}
@ -164,7 +165,7 @@ public:
for (const auto& r : bwRange) {
double step = (r.step() == 0.0) ? 100e3 : r.step();
for (double i = r.start(); i <= r.stop(); i += step) {
bandwidths.define((int)i, getBandwdithScaled(i), i);
bandwidths.define((int)i, utils::formatFreq(i), i);
}
}
@ -232,20 +233,6 @@ public:
}
private:
std::string getBandwdithScaled(double bw) {
char buf[1024];
// if (bw >= 1000000.0) {
// sprintf(buf, "%.1lfMHz", bw / 1000000.0);
// }
// else if (bw >= 1000.0) {
// sprintf(buf, "%.1lfKHz", bw / 1000.0);
// }
// else {
sprintf(buf, "%.1lfHz", bw);
//}
return std::string(buf);
}
static void menuSelected(void* ctx) {
USRPSourceModule* _this = (USRPSourceModule*)ctx;
@ -448,19 +435,24 @@ private:
void worker() {
// TODO: Select a better buffer size that will avoid bad timing
int bufferSize = sampleRate / 200;
while (true) {
uhd::rx_metadata_t meta;
void* ptr[] = { stream.writeBuf };
uhd::rx_streamer::buffs_type buffers(ptr, 1);
int len = streamer->recv(stream.writeBuf, bufferSize, meta, 1.0);
if (len < 0) { break; }
if (len != bufferSize) {
printf("%d\n", len);
}
if (len) {
if (!stream.swap(len)) { break; }
try {
while (true) {
uhd::rx_metadata_t meta;
void* ptr[] = { stream.writeBuf };
uhd::rx_streamer::buffs_type buffers(ptr, 1);
int len = streamer->recv(stream.writeBuf, bufferSize, meta, 1.0);
if (len < 0) { break; }
if (len != bufferSize) {
printf("%d\n", len);
}
if (len) {
if (!stream.swap(len)) { break; }
}
}
}
catch (const std::exception& e) {
flog::error("Failed to receive samples: {}", e.what());
}
}
std::string name;