mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-12-25 02:18:30 +01:00
added invert iq option
This commit is contained in:
parent
f49fbd2a73
commit
c95c7b18af
@ -214,6 +214,7 @@ int sdrpp_main(int argc, char* argv[]) {
|
|||||||
defConfig["source"] = "";
|
defConfig["source"] = "";
|
||||||
defConfig["decimationPower"] = 0;
|
defConfig["decimationPower"] = 0;
|
||||||
defConfig["iqCorrection"] = false;
|
defConfig["iqCorrection"] = false;
|
||||||
|
defConfig["invertIQ"] = false;
|
||||||
|
|
||||||
defConfig["streams"]["Radio"]["muted"] = false;
|
defConfig["streams"]["Radio"]["muted"] = false;
|
||||||
defConfig["streams"]["Radio"]["sink"] = "Audio";
|
defConfig["streams"]["Radio"]["sink"] = "Audio";
|
||||||
|
@ -13,6 +13,7 @@ namespace sourcemenu {
|
|||||||
double effectiveOffset = 0.0;
|
double effectiveOffset = 0.0;
|
||||||
int decimationPower = 0;
|
int decimationPower = 0;
|
||||||
bool iqCorrection = false;
|
bool iqCorrection = false;
|
||||||
|
bool invertIQ = false;
|
||||||
|
|
||||||
EventHandler<std::string> sourceRegisteredHandler;
|
EventHandler<std::string> sourceRegisteredHandler;
|
||||||
EventHandler<std::string> sourceUnregisterHandler;
|
EventHandler<std::string> sourceUnregisterHandler;
|
||||||
@ -138,7 +139,9 @@ namespace sourcemenu {
|
|||||||
offsetMode = core::configManager.conf["offsetMode"];
|
offsetMode = core::configManager.conf["offsetMode"];
|
||||||
decimationPower = core::configManager.conf["decimationPower"];
|
decimationPower = core::configManager.conf["decimationPower"];
|
||||||
iqCorrection = core::configManager.conf["iqCorrection"];
|
iqCorrection = core::configManager.conf["iqCorrection"];
|
||||||
|
invertIQ = core::configManager.conf["invertIQ"];
|
||||||
sigpath::iqFrontEnd.setDCBlocking(iqCorrection);
|
sigpath::iqFrontEnd.setDCBlocking(iqCorrection);
|
||||||
|
sigpath::iqFrontEnd.setInvertIQ(invertIQ);
|
||||||
updateOffset();
|
updateOffset();
|
||||||
|
|
||||||
refreshSources();
|
refreshSources();
|
||||||
@ -180,6 +183,13 @@ namespace sourcemenu {
|
|||||||
core::configManager.release(true);
|
core::configManager.release(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui::Checkbox("Invert IQ##_sdrpp_inv_iq", &invertIQ)) {
|
||||||
|
sigpath::iqFrontEnd.setInvertIQ(invertIQ);
|
||||||
|
core::configManager.acquire();
|
||||||
|
core::configManager.conf["invertIQ"] = invertIQ;
|
||||||
|
core::configManager.release(true);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::LeftLabel("Offset mode");
|
ImGui::LeftLabel("Offset mode");
|
||||||
ImGui::SetNextItemWidth(itemWidth - ImGui::GetCursorPosX());
|
ImGui::SetNextItemWidth(itemWidth - ImGui::GetCursorPosX());
|
||||||
if (ImGui::Combo("##_sdrpp_offset_mode", &offsetMode, offsetModesTxt)) {
|
if (ImGui::Combo("##_sdrpp_offset_mode", &offsetMode, offsetModesTxt)) {
|
||||||
|
@ -31,10 +31,12 @@ void IQFrontEnd::init(dsp::stream<dsp::complex_t>* in, double sampleRate, bool b
|
|||||||
|
|
||||||
decim.init(NULL, _decimRatio);
|
decim.init(NULL, _decimRatio);
|
||||||
dcBlock.init(NULL, genDCBlockRate(effectiveSr));
|
dcBlock.init(NULL, genDCBlockRate(effectiveSr));
|
||||||
|
conjugate.init(NULL);
|
||||||
|
|
||||||
preproc.init(&inBuf.out);
|
preproc.init(&inBuf.out);
|
||||||
preproc.addBlock(&decim, _decimRatio > 1);
|
preproc.addBlock(&decim, _decimRatio > 1);
|
||||||
preproc.addBlock(&dcBlock, dcBlocking);
|
preproc.addBlock(&dcBlock, dcBlocking);
|
||||||
|
preproc.addBlock(&conjugate, false); // TODO: Replace by parameter
|
||||||
|
|
||||||
split.init(preproc.out);
|
split.init(preproc.out);
|
||||||
|
|
||||||
@ -123,6 +125,10 @@ void IQFrontEnd::setDCBlocking(bool enabled) {
|
|||||||
preproc.setBlockEnabled(&dcBlock, enabled, [=](dsp::stream<dsp::complex_t>* out){ split.setInput(out); });
|
preproc.setBlockEnabled(&dcBlock, enabled, [=](dsp::stream<dsp::complex_t>* out){ split.setInput(out); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IQFrontEnd::setInvertIQ(bool enabled) {
|
||||||
|
preproc.setBlockEnabled(&conjugate, enabled, [=](dsp::stream<dsp::complex_t>* out){ split.setInput(out); });
|
||||||
|
}
|
||||||
|
|
||||||
void IQFrontEnd::bindIQStream(dsp::stream<dsp::complex_t>* stream) {
|
void IQFrontEnd::bindIQStream(dsp::stream<dsp::complex_t>* stream) {
|
||||||
split.bindStream(stream);
|
split.bindStream(stream);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "../dsp/routing/splitter.h"
|
#include "../dsp/routing/splitter.h"
|
||||||
#include "../dsp/channel/rx_vfo.h"
|
#include "../dsp/channel/rx_vfo.h"
|
||||||
#include "../dsp/sink/handler_sink.h"
|
#include "../dsp/sink/handler_sink.h"
|
||||||
|
#include "../dsp/math/conjugate.h"
|
||||||
#include <fftw3.h>
|
#include <fftw3.h>
|
||||||
|
|
||||||
class IQFrontEnd {
|
class IQFrontEnd {
|
||||||
@ -27,6 +28,7 @@ public:
|
|||||||
|
|
||||||
void setBuffering(bool enabled);
|
void setBuffering(bool enabled);
|
||||||
void setDecimation(int ratio);
|
void setDecimation(int ratio);
|
||||||
|
void setInvertIQ(bool enabled);
|
||||||
void setDCBlocking(bool enabled);
|
void setDCBlocking(bool enabled);
|
||||||
|
|
||||||
void bindIQStream(dsp::stream<dsp::complex_t>* stream);
|
void bindIQStream(dsp::stream<dsp::complex_t>* stream);
|
||||||
@ -65,6 +67,7 @@ protected:
|
|||||||
|
|
||||||
// Pre-processing chain
|
// Pre-processing chain
|
||||||
dsp::multirate::PowerDecimator<dsp::complex_t> decim;
|
dsp::multirate::PowerDecimator<dsp::complex_t> decim;
|
||||||
|
dsp::math::Conjugate conjugate;
|
||||||
dsp::correction::DCBlocker<dsp::complex_t> dcBlock;
|
dsp::correction::DCBlocker<dsp::complex_t> dcBlock;
|
||||||
dsp::chain<dsp::complex_t> preproc;
|
dsp::chain<dsp::complex_t> preproc;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user