mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-12 23:26:10 -05:00
Add swap I/Q setting for all devices
This commit is contained in:
parent
3f5ffc7aaa
commit
7bf0ad47c5
@ -561,26 +561,31 @@ void AppFrame::updateDeviceParams() {
|
||||
return;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
SoapySDR::Device *soapyDev = devInfo->getSoapyDevice();
|
||||
|
||||
// Build settings menu
|
||||
wxMenu *newSettingsMenu = new wxMenu;
|
||||
showTipMenuItem = newSettingsMenu->AppendCheckItem(wxID_SET_TIPS, "Show Hover Tips");
|
||||
if (wxGetApp().getConfig()->getShowTips()) {
|
||||
showTipMenuItem->Check();
|
||||
}
|
||||
showTipMenuItem->Check(wxGetApp().getConfig()->getShowTips());
|
||||
|
||||
newSettingsMenu->Append(wxID_SET_FREQ_OFFSET, "Frequency Offset");
|
||||
|
||||
if (devInfo->hasCORR(SOAPY_SDR_RX, 0)) {
|
||||
newSettingsMenu->Append(wxID_SET_PPM, "Device PPM");
|
||||
}
|
||||
|
||||
|
||||
if (devInfo->getDriver() != "rtlsdr") {
|
||||
iqSwapMenuItem = newSettingsMenu->AppendCheckItem(wxID_SET_IQSWAP, "I/Q Swap");
|
||||
iqSwapMenuItem->Check(wxGetApp().getSDRThread()->getIQSwap());
|
||||
}
|
||||
|
||||
agcMenuItem = newSettingsMenu->AppendCheckItem(wxID_AGC_CONTROL, "Automatic Gain");
|
||||
agcMenuItem->Check(wxGetApp().getAGCMode());
|
||||
|
||||
SoapySDR::ArgInfoList::const_iterator args_i;
|
||||
|
||||
int i = 0;
|
||||
SoapySDR::Device *soapyDev = devInfo->getSoapyDevice();
|
||||
settingArgs = soapyDev->getSettingInfo();
|
||||
|
||||
for (args_i = settingArgs.begin(); args_i != settingArgs.end(); args_i++) {
|
||||
SoapySDR::ArgInfo arg = (*args_i);
|
||||
std::string currentVal = soapyDev->readSetting(arg.key);
|
||||
@ -695,6 +700,8 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
|
||||
} else {
|
||||
wxGetApp().getConfig()->setShowTips(true);
|
||||
}
|
||||
} else if (event.GetId() == wxID_SET_IQSWAP) {
|
||||
wxGetApp().getSDRThread()->setIQSwap(!wxGetApp().getSDRThread()->getIQSwap());
|
||||
} else if (event.GetId() == wxID_SET_FREQ_OFFSET) {
|
||||
long ofs = wxGetNumberFromUser("Shift the displayed frequency by this amount.\ni.e. -125000000 for -125 MHz", "Frequency (Hz)",
|
||||
"Frequency Offset", wxGetApp().getOffset(), -2000000000, 2000000000, this);
|
||||
|
@ -27,6 +27,7 @@
|
||||
#define wxID_RESET 2002
|
||||
#define wxID_SET_PPM 2003
|
||||
#define wxID_SET_TIPS 2004
|
||||
#define wxID_SET_IQSWAP 2005
|
||||
#define wxID_SDR_DEVICES 2008
|
||||
#define wxID_AGC_CONTROL 2009
|
||||
|
||||
@ -127,6 +128,7 @@ private:
|
||||
wxMenuBar *menuBar;
|
||||
wxMenu *sampleRateMenu;
|
||||
wxMenuItem *agcMenuItem;
|
||||
wxMenuItem *iqSwapMenuItem;
|
||||
wxMenu *settingsMenu;
|
||||
SoapySDR::ArgInfoList settingArgs;
|
||||
int settingsIdMax;
|
||||
|
@ -36,6 +36,7 @@ SDRThread::SDRThread() : IOThread(), buffers("SDRThreadBuffers") {
|
||||
frequency_lock_init.store(false);
|
||||
frequency_locked.store(false);
|
||||
lock_freq.store(0);
|
||||
iq_swap.store(false);
|
||||
}
|
||||
|
||||
SDRThread::~SDRThread() {
|
||||
@ -194,15 +195,15 @@ void SDRThread::readStream(SDRThreadIQDataQueue* iqDataOutQueue) {
|
||||
if (n_read > 0 && !terminated) {
|
||||
SDRThreadIQData *dataOut = buffers.getBuffer();
|
||||
|
||||
// if (hasHardwareDC) {
|
||||
if (iq_swap.load()) {
|
||||
dataOut->data.resize(n_read);
|
||||
for (int i = 0; i < n_read; i++) {
|
||||
dataOut->data[i].imag = inpBuffer.data[i].real;
|
||||
dataOut->data[i].real = inpBuffer.data[i].imag;
|
||||
}
|
||||
} else {
|
||||
dataOut->data.assign(inpBuffer.data.begin(), inpBuffer.data.begin()+n_read);
|
||||
// } else {
|
||||
// if (dataOut->data.size() != n_read) {
|
||||
// dataOut->data.resize(n_read);
|
||||
// }
|
||||
// iirfilt_crcf_execute_block(dcFilter, &inpBuffer.data[0], n_read, &dataOut->data[0]);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
dataOut->setRefCount(1);
|
||||
dataOut->frequency = frequency.load();
|
||||
@ -484,6 +485,14 @@ bool SDRThread::getAGCMode() {
|
||||
return agc_mode.load();
|
||||
}
|
||||
|
||||
void SDRThread::setIQSwap(bool swap) {
|
||||
iq_swap.store(swap);
|
||||
}
|
||||
|
||||
bool SDRThread::getIQSwap() {
|
||||
return iq_swap.load();
|
||||
}
|
||||
|
||||
void SDRThread::setGain(std::string name, float value) {
|
||||
gain_busy.lock();
|
||||
gainValues[name] = value;
|
||||
|
@ -76,6 +76,9 @@ public:
|
||||
void setAGCMode(bool mode);
|
||||
bool getAGCMode();
|
||||
|
||||
void setIQSwap(bool swap);
|
||||
bool getIQSwap();
|
||||
|
||||
void setGain(std::string name, float value);
|
||||
float getGain(std::string name);
|
||||
|
||||
@ -108,7 +111,7 @@ protected:
|
||||
std::atomic_int ppm, numElems, mtuElems, numChannels;
|
||||
std::atomic_bool hasPPM, hasHardwareDC;
|
||||
std::atomic_bool agc_mode, rate_changed, freq_changed, offset_changed,
|
||||
ppm_changed, device_changed, agc_mode_changed, gain_value_changed, setting_value_changed, frequency_locked, frequency_lock_init;
|
||||
ppm_changed, device_changed, agc_mode_changed, gain_value_changed, setting_value_changed, frequency_locked, frequency_lock_init, iq_swap;
|
||||
|
||||
std::mutex gain_busy;
|
||||
std::map<std::string, float> gainValues;
|
||||
|
Loading…
Reference in New Issue
Block a user