From b411ba5420d4937515c473adddf9ebd2e10e771c Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 5 Sep 2017 14:11:25 +0200 Subject: [PATCH] PlutoSDR input: use constants for frequency limits --- devices/plutosdr/deviceplutosdr.cpp | 11 +++++++++++ devices/plutosdr/deviceplutosdr.h | 11 +++++++++++ .../samplesource/plutosdrinput/plutosdrinputgui.cpp | 9 +++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/devices/plutosdr/deviceplutosdr.cpp b/devices/plutosdr/deviceplutosdr.cpp index a73fe3a89..54d2d164e 100644 --- a/devices/plutosdr/deviceplutosdr.cpp +++ b/devices/plutosdr/deviceplutosdr.cpp @@ -16,6 +16,17 @@ #include "deviceplutosdr.h" +const uint64_t DevicePlutoSDR::loLowLimitFreq = 70000000UL; // 70 MHz: take AD9364 specs +const uint64_t DevicePlutoSDR::loHighLimitFreq = 6000000000UL; // 6 GHz: take AD9364 specs + +const uint32_t DevicePlutoSDR::srLowLimitFreq = 200000; // 200 kS/s +const uint32_t DevicePlutoSDR::srHighLimitFreq = 2000000; // 20 MS/s: take AD9363 speces + +const uint32_t DevicePlutoSDR::bbLPRxLowLimitFreq = 200000; // 200 kHz +const uint32_t DevicePlutoSDR::bbLPRxHighLimitFreq = 14000000; // 14 MHz +const uint32_t DevicePlutoSDR::bbLPTxLowLimitFreq = 625000; // 625 kHz +const uint32_t DevicePlutoSDR::bbLPTxHighLimitFreq = 16000000; // 16 MHz + DevicePlutoSDR::DevicePlutoSDR() { } diff --git a/devices/plutosdr/deviceplutosdr.h b/devices/plutosdr/deviceplutosdr.h index 93a5e9b5f..f7c69fcab 100644 --- a/devices/plutosdr/deviceplutosdr.h +++ b/devices/plutosdr/deviceplutosdr.h @@ -17,6 +17,8 @@ #ifndef DEVICES_PLUTOSDR_DEVICEPLUTOSDR_H_ #define DEVICES_PLUTOSDR_DEVICEPLUTOSDR_H_ +#include + #include "deviceplutosdrscan.h" #include "deviceplutosdrbox.h" @@ -32,6 +34,15 @@ public: DevicePlutoSDRBox* getDeviceFromURI(const std::string& uri); DevicePlutoSDRBox* getDeviceFromSerial(const std::string& serial); + static const uint64_t loLowLimitFreq; //!< LO lower frequency limit (Hz) + static const uint64_t loHighLimitFreq; //!< LO lower frequency limit (Hz) + static const uint32_t srLowLimitFreq; //!< Device sample rate lower limit in S/s + static const uint32_t srHighLimitFreq; //!< Device sample rate higher limit in S/s + static const uint32_t bbLPRxLowLimitFreq; //!< Analog base band Rx low pass filter lower frequency limit (Hz) + static const uint32_t bbLPRxHighLimitFreq; //!< Analog base band Rx high pass filter lower frequency limit (Hz) + static const uint32_t bbLPTxLowLimitFreq; //!< Analog base band Tx low pass filter lower frequency limit (Hz) + static const uint32_t bbLPTxHighLimitFreq; //!< Analog base band Tx high pass filter lower frequency limit (Hz) + protected: DevicePlutoSDR(); ~DevicePlutoSDR(); diff --git a/plugins/samplesource/plutosdrinput/plutosdrinputgui.cpp b/plugins/samplesource/plutosdrinput/plutosdrinputgui.cpp index 55a743c73..ef0f13deb 100644 --- a/plugins/samplesource/plutosdrinput/plutosdrinputgui.cpp +++ b/plugins/samplesource/plutosdrinput/plutosdrinputgui.cpp @@ -17,6 +17,7 @@ #include #include "device/devicesourceapi.h" +#include "plutosdr/deviceplutosdr.h" #include "plutosdrinput.h" #include "ui_plutosdrinputgui.h" #include "plutosdrinputgui.h" @@ -43,16 +44,16 @@ PlutoSDRInputGui::PlutoSDRInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent) ui->setupUi(this); ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); - ui->centerFrequency->setValueRange(7, 325000U, 3800000U); + ui->centerFrequency->setValueRange(7, DevicePlutoSDR::loLowLimitFreq/1000, DevicePlutoSDR::loHighLimitFreq/1000); ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow)); - ui->sampleRate->setValueRange(8, (uint32_t) minF, (uint32_t) maxF); + ui->sampleRate->setValueRange(8, DevicePlutoSDR::srLowLimitFreq, DevicePlutoSDR::srHighLimitFreq); ui->lpf->setColorMapper(ColorMapper(ColorMapper::GrayYellow)); - ui->lpf->setValueRange(6, (minF/1000)+1, maxF/1000); + ui->lpf->setValueRange(5, DevicePlutoSDR::bbLPRxLowLimitFreq/1000, DevicePlutoSDR::bbLPRxHighLimitFreq/1000); ui->lpFIR->setColorMapper(ColorMapper(ColorMapper::GrayYellow)); - ui->lpFIR->setValueRange(5, 1U, 56000U); + ui->lpFIR->setValueRange(5, 1U, 56000U); // will be dynamically recalculated connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));