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