Fixed FIR bug with the pluto module

pull/40/head
Ryzerth 2020-11-26 19:25:58 +01:00
rodzic e06ed84330
commit eac0a7a13f
5 zmienionych plików z 47 dodań i 22 usunięć

Wyświetl plik

@ -21,6 +21,7 @@ if (MSVC)
target_include_directories(sdrpp_core PUBLIC "C:/Program Files/PothosSDR/include/")
target_link_libraries(plutosdr_source PUBLIC libiio)
target_link_libraries(plutosdr_source PUBLIC libad9361)
else (MSVC)
find_package(PkgConfig)

Wyświetl plik

@ -6,6 +6,7 @@
#include <core.h>
#include <gui/style.h>
#include <iio.h>
#include <ad9361.h>
#define CONCAT(a, b) ((std::string(a) + b).c_str())
@ -84,11 +85,16 @@ private:
}
// Configure pluto
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "altvoltage0", true), "frequency", _this->freq); // Freq
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "voltage0", false), "sampling_frequency", _this->sampleRate); // Sample rate
iio_channel_attr_write(iio_device_find_channel(_this->phy, "voltage0", false), "gain_control_mode", "manual"); // manual gain
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "voltage0", false), "hardwaregain", _this->gain); // gain
iio_channel_attr_write_bool(iio_device_find_channel(_this->phy, "altvoltage1", true), "powerdown", true);
iio_channel_attr_write_bool(iio_device_find_channel(_this->phy, "altvoltage0", true), "powerdown", false);
iio_channel_attr_write(iio_device_find_channel(_this->phy, "voltage0", false), "rf_port_select", "A_BALANCED");
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "altvoltage0", true), "frequency", round(_this->freq)); // Freq
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "voltage0", false), "sampling_frequency", round(_this->sampleRate)); // Sample rate
iio_channel_attr_write(iio_device_find_channel(_this->phy, "voltage0", false), "gain_control_mode", gainModes[_this->gainMode]); // manual gain
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "voltage0", false), "hardwaregain", round(_this->gain)); // gain
ad9361_set_bb_rate(_this->phy, round(_this->sampleRate));
_this->running = true;
_this->workerThread = std::thread(worker, _this);
spdlog::info("PlutoSDRSourceModule '{0}': Start!", _this->name);
@ -115,11 +121,11 @@ private:
static void tune(double freq, void* ctx) {
PlutoSDRSourceModule* _this = (PlutoSDRSourceModule*)ctx;
_this->freq = freq;
if (_this->running) {
// SET PLUTO FREQ HERE
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "altvoltage0", true), "frequency", _this->freq);
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "altvoltage0", true), "frequency", round(_this->freq));
}
_this->freq = freq;
spdlog::info("PlutoSDRSourceModule '{0}': Tune: {1}!", _this->name, freq);
}
@ -130,25 +136,37 @@ private:
ImGui::Text("IP");
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
ImGui::InputText("", &_this->ip[3], 16);
ImGui::InputText(CONCAT("##_pluto_ip_", _this->name), &_this->ip[3], 16);
// SELECT PLUTO HERE
ImGui::Text("Samplerate");
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (_this->running) { style::beginDisabled(); }
if (ImGui::InputFloat(CONCAT("##_samplerate_select_", _this->name), &_this->sampleRate, 1, 1000, 0)) {
core::setInputSampleRate(_this->sampleRate);
}
if (_this->running) { style::endDisabled(); }
ImGui::Text("Gain Mode");
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::Combo("", &_this->gainMode, gainModesTxt)) {
if (ImGui::Combo(CONCAT("##_gainmode_select_", _this->name), &_this->gainMode, gainModesTxt)) {
if (_this->running) {
iio_channel_attr_write(iio_device_find_channel(_this->phy, "voltage0", false), "gain_control_mode", gainModes[_this->gainMode]);
}
}
ImGui::Text("PGA Gain");
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (_this->gainMode) { style::beginDisabled(); }
if (ImGui::SliderFloat(CONCAT("##_gain_select_", _this->name), &_this->gain, 0, 76)) {
if (_this->running) {
// SET PLUTO GAIN HERE
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "voltage0", false),"hardwaregain", _this->gain);
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "voltage0", false),"hardwaregain", round(_this->gain));
}
}
if (_this->gainMode) { style::endDisabled(); }
}
static void worker(void* ctx) {
@ -190,13 +208,14 @@ private:
std::string name;
dsp::stream<dsp::complex_t> stream;
double sampleRate;
float sampleRate;
SourceManager::SourceHandler handler;
std::thread workerThread;
struct iio_context *ctx = NULL;
struct iio_device *phy = NULL;
struct iio_device *dev = NULL;
bool running = false;
bool ipMode = true;
double freq;
char ip[1024] = "ip:192.168.2.1";
int port = 1234;

Wyświetl plik

@ -3,6 +3,7 @@
SDR++ is a cross-platform and open source SDR software with the aim of being bloat free and simple to use.
## Current Features
* Uses SoapySDR for wide hardware support
* Hardware accelerated graphics (OpenGL + ImGui)
* SIMD accelerated DSP (parts of the DSP are still missing)
@ -10,12 +11,14 @@ SDR++ is a cross-platform and open source SDR software with the aim of being blo
* Full waterfall update when possible. Makes browsing signals easier and more pleasant
## Comming soon
* Multi-VFO
* Plugins
* Digital demodulators and decoders
* Quick replay (replay last n seconds, cool if you missed a short signal)
## Small things to add
* Switchable bandwidth for demodulators
* Switchable audio output device and sample rate
* Recording
@ -29,6 +32,7 @@ SDR++ is a cross-platform and open source SDR software with the aim of being blo
* Input filter bandwidth option
## Known issues (please check before reporting)
* Random crashes (yikes)
* Gains aren't stepped
* The default gains might contain a bogus value before being adjusted
@ -38,6 +42,7 @@ SDR++ is a cross-platform and open source SDR software with the aim of being blo
# Building on Windows
## Requirements
* cmake
* vcpkg (for the packages listed below)
* fftw3

Wyświetl plik

@ -3,7 +3,7 @@
"Radio": {
"device": "Speakers (Realtek High Definiti",
"sampleRate": 48000.0,
"volume": 0.3777777850627899
"volume": 0.546875
},
"Radio 1": {
"device": "Speakers (Realtek High Definition Audio)",
@ -20,7 +20,7 @@
"bandPlanEnabled": true,
"defaultSink": "Audio",
"fftHeight": 296,
"frequency": 99000000,
"frequency": 1090020000,
"max": 0.0,
"maximized": false,
"menuOrder": [
@ -33,7 +33,7 @@
"Display"
],
"menuWidth": 300,
"min": -69.11764526367188,
"min": -70.5882339477539,
"showWaterfall": true,
"source": "",
"sourceSettings": {},

Wyświetl plik

@ -5,12 +5,12 @@
"gains": {
"PGA": 0.0
},
"sampleRate": 4000000.0
"sampleRate": 8000000.0
},
"AirSpy HF+ [c852435de0224af7]": {
"gains": {
"LNA": 6.0,
"RF": 0.0
"LNA": 5.989999771118164,
"RF": 6.0
},
"sampleRate": 768000.0
},
@ -22,17 +22,17 @@
},
"Generic RTL2832U OEM :: 00000001": {
"gains": {
"TUNER": 7.244999885559082
"TUNER": 0.0
},
"sampleRate": 250000.0
"sampleRate": 2560000.0
},
"HackRF One #0 901868dc282c8f8b": {
"gains": {
"AMP": 0.0,
"LNA": 24.711999893188477,
"VGA": 16.02899932861328
"VGA": 21.749000549316406
},
"sampleRate": 8000000.0
"sampleRate": 2000000.0
},
"Microphone (Realtek High Definition Audio)": {
"sampleRate": 96000.0