From df9e1d5900e802ff6e4ba4ca140cc8693dbb57d6 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 7 May 2017 01:47:31 +0200 Subject: [PATCH] LimeSDR input: antenna select fixes --- devices/limesdr/devicelimesdr.cpp | 6 +++--- devices/limesdr/devicelimesdr.h | 4 ++-- plugins/samplesource/limesdrinput/limesdrinput.cpp | 2 +- plugins/samplesource/limesdrinput/limesdrinputgui.cpp | 2 ++ plugins/samplesource/limesdrinput/limesdrinputgui.ui | 5 ++++- plugins/samplesource/limesdrinput/limesdrinputsettings.cpp | 3 +++ plugins/samplesource/limesdrinput/readme.md | 6 +++--- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/devices/limesdr/devicelimesdr.cpp b/devices/limesdr/devicelimesdr.cpp index a82702b89..2a36d82ac 100644 --- a/devices/limesdr/devicelimesdr.cpp +++ b/devices/limesdr/devicelimesdr.cpp @@ -179,7 +179,7 @@ bool DeviceLimeSDR::SetRBBPGA_dB(lms_device_t *device, std::size_t chan, float v return true; } -bool DeviceLimeSDR::setAntennaPath(lms_device_t *device, std::size_t chan, int path) +bool DeviceLimeSDR::setRxAntennaPath(lms_device_t *device, std::size_t chan, int path) { // if (LMS_WriteParam(device, LMS7param(MAC), chan+1) < 0) // { @@ -245,7 +245,7 @@ bool DeviceLimeSDR::setAntennaPath(lms_device_t *device, std::size_t chan, int p // // return true; - switch ((PathRFE) path) + switch ((PathRxRFE) path) { case PATH_RFE_LNAH: if (LMS_SetAntenna(device, LMS_CH_RX, chan, 1) < 0) @@ -262,7 +262,7 @@ bool DeviceLimeSDR::setAntennaPath(lms_device_t *device, std::size_t chan, int p } break; case PATH_RFE_LNAW: - if (LMS_SetAntenna(device, LMS_CH_RX, chan, 2) < 0) + if (LMS_SetAntenna(device, LMS_CH_RX, chan, 3) < 0) { fprintf(stderr, "DeviceLimeSDR::setAntennaPath: cannot set to LNAW\n"); return false; diff --git a/devices/limesdr/devicelimesdr.h b/devices/limesdr/devicelimesdr.h index a3624b72f..7f85f9ba8 100644 --- a/devices/limesdr/devicelimesdr.h +++ b/devices/limesdr/devicelimesdr.h @@ -22,7 +22,7 @@ class DeviceLimeSDR { public: - enum PathRFE + enum PathRxRFE { PATH_RFE_NONE = 0, PATH_RFE_LNAH, @@ -41,7 +41,7 @@ public: /** set PGA gain Range: [0-32] (dB) **/ static bool SetRBBPGA_dB(lms_device_t *device, std::size_t chan, float value); /** Set antenna path **/ - static bool setAntennaPath(lms_device_t *device, std::size_t chan, int path); + static bool setRxAntennaPath(lms_device_t *device, std::size_t chan, int path); }; #endif /* DEVICES_LIMESDR_DEVICELIMESDR_H_ */ diff --git a/plugins/samplesource/limesdrinput/limesdrinput.cpp b/plugins/samplesource/limesdrinput/limesdrinput.cpp index 44a67ef3b..ef472bc98 100644 --- a/plugins/samplesource/limesdrinput/limesdrinput.cpp +++ b/plugins/samplesource/limesdrinput/limesdrinput.cpp @@ -708,7 +708,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc if (m_deviceShared.m_deviceParams->getDevice() != 0) { - if (DeviceLimeSDR::setAntennaPath(m_deviceShared.m_deviceParams->getDevice(), + if (DeviceLimeSDR::setRxAntennaPath(m_deviceShared.m_deviceParams->getDevice(), m_deviceShared.m_channel, m_settings.m_antennaPath)) { diff --git a/plugins/samplesource/limesdrinput/limesdrinputgui.cpp b/plugins/samplesource/limesdrinput/limesdrinputgui.cpp index 135f5a1e5..e8ca12ab4 100644 --- a/plugins/samplesource/limesdrinput/limesdrinputgui.cpp +++ b/plugins/samplesource/limesdrinput/limesdrinputgui.cpp @@ -264,6 +264,8 @@ void LimeSDRInputGUI::displaySettings() ui->gain->setValue(m_settings.m_gain); ui->gainText->setText(tr("%1dB").arg(m_settings.m_gain)); + ui->antenna->setCurrentIndex((int) m_settings.m_antennaPath); + setNCODisplay(); } diff --git a/plugins/samplesource/limesdrinput/limesdrinputgui.ui b/plugins/samplesource/limesdrinput/limesdrinputgui.ui index d206c98b3..135166fa0 100644 --- a/plugins/samplesource/limesdrinput/limesdrinputgui.ui +++ b/plugins/samplesource/limesdrinput/limesdrinputgui.ui @@ -668,9 +668,12 @@ 16777215 + + Antenna select: No: none, Lo: 700:900M, Hi: 2:2.6G, Wi: wideband, T1: Tx1 LB, T2: Tx2 LB + - Au + No diff --git a/plugins/samplesource/limesdrinput/limesdrinputsettings.cpp b/plugins/samplesource/limesdrinput/limesdrinputsettings.cpp index 3af15c60e..60412f7b0 100644 --- a/plugins/samplesource/limesdrinput/limesdrinputsettings.cpp +++ b/plugins/samplesource/limesdrinput/limesdrinputsettings.cpp @@ -54,6 +54,7 @@ QByteArray LimeSDRInputSettings::serialize() const s.writeU32(10, m_gain); s.writeBool(11, m_ncoEnable); s.writeS32(12, m_ncoFrequency); + s.writeS32(13, (int) m_antennaPath); return s.final(); } @@ -83,6 +84,8 @@ bool LimeSDRInputSettings::deserialize(const QByteArray& data) d.readU32(10, &m_gain, 0); d.readBool(11, &m_ncoEnable, false); d.readS32(12, &m_ncoFrequency, 0); + d.readS32(13, &intval, 0); + m_antennaPath = (PathRFE) intval; return true; } diff --git a/plugins/samplesource/limesdrinput/readme.md b/plugins/samplesource/limesdrinput/readme.md index a191463fb..676e001df 100644 --- a/plugins/samplesource/limesdrinput/readme.md +++ b/plugins/samplesource/limesdrinput/readme.md @@ -126,9 +126,9 @@ Use this slider to adjust the global gain of the LNA, TIA and PGA. LimeSuite sof Use this combo box to select the antenna input: - - **Au**: Auto: automatically selects optimal input depending on LO center frequency - - **Lo**: Selects the low frequency input - - **Hi**: Selects the high frequncy input + - **No**: None + - **Lo**: Selects the low frequency input (700 to 900 MHz nominally) + - **Hi**: Selects the high frequncy input (2 to 2.6 GHz) - **Wo**: Selects the wideband input - **T1**: Selects loopback from TX #1 (experimental) - **T1**: Selects loopback from TX #2 (experimental)