diff --git a/plugins/samplesource/CMakeLists.txt b/plugins/samplesource/CMakeLists.txt index 56056e57a..2a78f32a7 100644 --- a/plugins/samplesource/CMakeLists.txt +++ b/plugins/samplesource/CMakeLists.txt @@ -40,7 +40,7 @@ endif(LIBUSB_FOUND AND LIBAIRSPY_FOUND) find_package(LibAIRSPYHF) if(LIBUSB_FOUND AND LIBAIRSPYHF_FOUND) add_subdirectory(airspyhf) - add_subdirectory(airspyhff) + add_subdirectory(airspyhfi) endif(LIBUSB_FOUND AND LIBAIRSPYHF_FOUND) find_package(LibHACKRF) diff --git a/plugins/samplesource/airspyhf/airspyhf.pro b/plugins/samplesource/airspyhf/airspyhff.pro similarity index 100% rename from plugins/samplesource/airspyhf/airspyhf.pro rename to plugins/samplesource/airspyhf/airspyhff.pro diff --git a/plugins/samplesource/airspyhf/airspyhfgui.cpp b/plugins/samplesource/airspyhf/airspyhfgui.cpp index dfbc6af28..e8e31681f 100644 --- a/plugins/samplesource/airspyhf/airspyhfgui.cpp +++ b/plugins/samplesource/airspyhf/airspyhfgui.cpp @@ -19,8 +19,6 @@ #include -#include "airspyhfgui.h" - #include #include "device/deviceuiset.h" #include @@ -30,6 +28,7 @@ #include "gui/glspectrum.h" #include "dsp/dspengine.h" #include "dsp/dspcommands.h" +#include "airspyhfgui.h" AirspyHFGui::AirspyHFGui(DeviceUISet *deviceUISet, QWidget* parent) : QWidget(parent), @@ -219,7 +218,6 @@ void AirspyHFGui::displaySettings() ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); ui->LOppm->setValue(m_settings.m_LOppmTenths); ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1))); - ui->autoCorr->setCurrentIndex(m_settings.m_autoCorrOptions); ui->sampleRate->setCurrentIndex(m_settings.m_devSampleRateIndex); ui->decim->setCurrentIndex(m_settings.m_log2Decim); ui->band->blockSignals(false); @@ -278,16 +276,6 @@ void AirspyHFGui::on_resetLOppm_clicked() ui->LOppm->setValue(0); } -void AirspyHFGui::on_autoCorr_currentIndexChanged(int index) -{ - if ((index < 0) || (index > AirspyHFSettings::AutoCorrLast)) { - return; - } - - m_settings.m_autoCorrOptions = (AirspyHFSettings::AutoCorrOptions) index; - sendSettings(); -} - void AirspyHFGui::on_sampleRate_currentIndexChanged(int index) { m_settings.m_devSampleRateIndex = index; diff --git a/plugins/samplesource/airspyhf/airspyhfgui.h b/plugins/samplesource/airspyhf/airspyhfgui.h index be340ed99..d5b43503e 100644 --- a/plugins/samplesource/airspyhf/airspyhfgui.h +++ b/plugins/samplesource/airspyhf/airspyhfgui.h @@ -22,6 +22,7 @@ #include #include "util/messagequeue.h" + #include "airspyhfinput.h" class DeviceUISet; @@ -79,7 +80,6 @@ private slots: void on_centerFrequency_changed(quint64 value); void on_LOppm_valueChanged(int value); void on_resetLOppm_clicked(); - void on_autoCorr_currentIndexChanged(int index); void on_sampleRate_currentIndexChanged(int index); void on_decim_currentIndexChanged(int index); void on_startStop_toggled(bool checked); diff --git a/plugins/samplesource/airspyhf/airspyhfgui.ui b/plugins/samplesource/airspyhf/airspyhfgui.ui index 06c58c5e9..f08fe7d30 100644 --- a/plugins/samplesource/airspyhf/airspyhfgui.ui +++ b/plugins/samplesource/airspyhf/airspyhfgui.ui @@ -7,7 +7,7 @@ 0 0 324 - 174 + 132 @@ -237,52 +237,6 @@ - - - - - - Corr - - - - - - - DC offset and IQ correction options - - - - None - - - - - DC - - - - - DC+IQ - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - diff --git a/plugins/samplesource/airspyhf/airspyhfinput.cpp b/plugins/samplesource/airspyhf/airspyhfinput.cpp index c2dfa31e5..64f832d0b 100644 --- a/plugins/samplesource/airspyhf/airspyhfinput.cpp +++ b/plugins/samplesource/airspyhf/airspyhfinput.cpp @@ -21,14 +21,15 @@ #include "SWGDeviceSettings.h" #include "SWGDeviceState.h" -#include "airspyhfgui.h" -#include "airspyhfinput.h" -#include "airspyhfplugin.h" - #include #include #include "dsp/dspcommands.h" #include "dsp/dspengine.h" + +#include "airspyhfinput.h" + +#include "airspyhfgui.h" +#include "airspyhfplugin.h" #include "airspyhfsettings.h" #include "airspyhfthread.h" @@ -87,12 +88,12 @@ bool AirspyHFInput::openDevice() if ((m_dev = open_airspyhf_from_serial(m_deviceAPI->getSampleSourceSerial())) == 0) { - qCritical("AirspyHFInput::start: could not open Airspy with serial %s", qPrintable(m_deviceAPI->getSampleSourceSerial())); + qCritical("AirspyHFInput::start: could not open Airspy HF with serial %s", qPrintable(m_deviceAPI->getSampleSourceSerial())); return false; } else { - qDebug("AirspyHFInput::start: opened Airspy with serial %s", qPrintable(m_deviceAPI->getSampleSourceSerial())); + qDebug("AirspyHFInput::start: opened Airspy HF with serial %s", qPrintable(m_deviceAPI->getSampleSourceSerial())); } uint32_t nbSampleRates; @@ -102,11 +103,11 @@ bool AirspyHFInput::openDevice() if (rc == AIRSPYHF_SUCCESS) { - qDebug("AirspyHFInput::start: %d sample rates for AirspyHF", nbSampleRates); + qDebug("AirspyHFInput::start: %d sample rates for Airspy HF", nbSampleRates); } else { - qCritical("AirspyHFInput::start: could not obtain the number of AirspyHF sample rates"); + qCritical("AirspyHFInput::start: could not obtain the number of Airspy HF sample rates"); return false; } @@ -116,11 +117,11 @@ bool AirspyHFInput::openDevice() if (rc == AIRSPYHF_SUCCESS) { - qDebug("AirspyHFInput::start: obtained AirspyHF sample rates"); + qDebug("AirspyHFInput::start: obtained Airspy HF sample rates"); } else { - qCritical("AirspyHFInput::start: could not obtain AirspyHF sample rates"); + qCritical("AirspyHFInput::start: could not obtain Airspy HF sample rates"); return false; } @@ -134,7 +135,7 @@ bool AirspyHFInput::openDevice() delete[] sampleRates; - airspyhf_set_sample_type(m_dev, AIRSPYHF_SAMPLE_INT16_NDSP_IQ); + airspyhf_set_sample_type(m_dev, AIRSPYHF_SAMPLE_FLOAT32_IQ); return true; } @@ -349,23 +350,6 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force) qDebug() << "AirspyHFInput::applySettings"; - if ((m_settings.m_autoCorrOptions != settings.m_autoCorrOptions) || force) - { - switch(settings.m_autoCorrOptions) - { - case AirspyHFSettings::AutoCorrDC: - m_deviceAPI->configureCorrections(true, false); - break; - case AirspyHFSettings::AutoCorrDCAndIQ: - m_deviceAPI->configureCorrections(true, true); - break; - case AirspyHFSettings::AutoCorrNone: - default: - m_deviceAPI->configureCorrections(false, false); - break; - } - } - if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force) { forwardChange = true; diff --git a/plugins/samplesource/airspyhf/airspyhfinput.h b/plugins/samplesource/airspyhf/airspyhfinput.h index 5d9c84174..f88e312ab 100644 --- a/plugins/samplesource/airspyhf/airspyhfinput.h +++ b/plugins/samplesource/airspyhf/airspyhfinput.h @@ -22,6 +22,7 @@ #include #include + #include "airspyhfsettings.h" class DeviceSourceAPI; diff --git a/plugins/samplesource/airspyhf/airspyhfplugin.cpp b/plugins/samplesource/airspyhf/airspyhfplugin.cpp index 61c48e2f7..e5e4fc5f3 100644 --- a/plugins/samplesource/airspyhf/airspyhfplugin.cpp +++ b/plugins/samplesource/airspyhf/airspyhfplugin.cpp @@ -18,12 +18,11 @@ #include #include -#include "airspyhfgui.h" -#include "airspyhfplugin.h" - #include #include "plugin/pluginapi.h" #include "util/simpleserializer.h" +#include "airspyhfplugin.h" +#include "airspyhfgui.h" const PluginDescriptor AirspyHFPlugin::m_pluginDescriptor = { @@ -84,7 +83,7 @@ PluginInterface::SamplingDevices AirspyHFPlugin::enumSampleSources() 1, 0)); - qDebug("AirspyPlugin::enumSampleSources: enumerated Airspy device #%d", i); + qDebug("AirspyHFPlugin::enumSampleSources: enumerated Airspy HF device #%d", i); } else { diff --git a/plugins/samplesource/airspyhf/airspyhfplugin.h b/plugins/samplesource/airspyhf/airspyhfplugin.h index 3bc6b4a43..ed7035cb8 100644 --- a/plugins/samplesource/airspyhf/airspyhfplugin.h +++ b/plugins/samplesource/airspyhf/airspyhfplugin.h @@ -50,4 +50,4 @@ private: static const PluginDescriptor m_pluginDescriptor; }; -#endif // INCLUDE_AIRSPYPLUGIN_H +#endif // INCLUDE_AIRSPYHFPLUGIN_H diff --git a/plugins/samplesource/airspyhf/airspyhfsettings.cpp b/plugins/samplesource/airspyhf/airspyhfsettings.cpp index 903fdb4d0..46818093f 100644 --- a/plugins/samplesource/airspyhf/airspyhfsettings.cpp +++ b/plugins/samplesource/airspyhf/airspyhfsettings.cpp @@ -16,6 +16,7 @@ #include #include "util/simpleserializer.h" + #include "airspyhfsettings.h" AirspyHFSettings::AirspyHFSettings() @@ -32,7 +33,6 @@ void AirspyHFSettings::resetToDefaults() m_transverterMode = false; m_transverterDeltaFrequency = 0; m_bandIndex = 0; - m_autoCorrOptions = AutoCorrNone; } QByteArray AirspyHFSettings::serialize() const @@ -42,7 +42,6 @@ QByteArray AirspyHFSettings::serialize() const s.writeU32(1, m_devSampleRateIndex); s.writeS32(2, m_LOppmTenths); s.writeU32(3, m_log2Decim); - s.writeS32(4, (int) m_autoCorrOptions); s.writeBool(7, m_transverterMode); s.writeS64(8, m_transverterDeltaFrequency); s.writeU32(9, m_bandIndex); @@ -69,13 +68,6 @@ bool AirspyHFSettings::deserialize(const QByteArray& data) d.readS32(2, &m_LOppmTenths, 0); d.readU32(3, &m_log2Decim, 0); d.readS32(4, &intval, 0); - - if (intval < 0 || intval > (int) AutoCorrLast) { - m_autoCorrOptions = AutoCorrNone; - } else { - m_autoCorrOptions = (AutoCorrOptions) intval; - } - d.readBool(7, &m_transverterMode, false); d.readS64(8, &m_transverterDeltaFrequency, 0); d.readU32(9, &uintval, 0); diff --git a/plugins/samplesource/airspyhf/airspyhfsettings.h b/plugins/samplesource/airspyhf/airspyhfsettings.h index 6aac4f318..b806b59eb 100644 --- a/plugins/samplesource/airspyhf/airspyhfsettings.h +++ b/plugins/samplesource/airspyhf/airspyhfsettings.h @@ -14,18 +14,11 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#ifndef _AIRSPYHF_AIRSPYHFSETTINGS_H_ -#define _AIRSPYHF_AIRSPYHFSETTINGS_H_ +#ifndef _AIRSPYHFF_AIRSPYHFSETTINGS_H_ +#define _AIRSPYHFF_AIRSPYHFSETTINGS_H_ struct AirspyHFSettings { - typedef enum { - AutoCorrNone, - AutoCorrDC, - AutoCorrDCAndIQ, - AutoCorrLast, - } AutoCorrOptions; - quint64 m_centerFrequency; qint32 m_LOppmTenths; quint32 m_devSampleRateIndex; @@ -33,7 +26,6 @@ struct AirspyHFSettings bool m_transverterMode; qint64 m_transverterDeltaFrequency; quint32 m_bandIndex; - AutoCorrOptions m_autoCorrOptions; AirspyHFSettings(); void resetToDefaults(); @@ -41,4 +33,4 @@ struct AirspyHFSettings bool deserialize(const QByteArray& data); }; -#endif /* _AIRSPYHF_AIRSPYHFSETTINGS_H_ */ +#endif /* _AIRSPYHFF_AIRSPYHFSETTINGS_H_ */ diff --git a/plugins/samplesource/airspyhf/airspyhfthread.cpp b/plugins/samplesource/airspyhf/airspyhfthread.cpp index 9959f2d4b..3a1fba0d6 100644 --- a/plugins/samplesource/airspyhf/airspyhfthread.cpp +++ b/plugins/samplesource/airspyhf/airspyhfthread.cpp @@ -17,9 +17,8 @@ #include #include -#include "airspyhfthread.h" - #include "dsp/samplesinkfifo.h" +#include "airspyhfthread.h" AirspyHFThread *AirspyHFThread::m_this = 0; @@ -78,7 +77,7 @@ void AirspyHFThread::run() if (rc != AIRSPYHF_SUCCESS) { - qCritical("AirspyHFThread::run: failed to start Airspy Rx"); + qCritical("AirspyHFFThread::run: failed to start Airspy HF Rx"); } else { @@ -91,16 +90,16 @@ void AirspyHFThread::run() rc = (airspyhf_error) airspyhf_stop(m_dev); if (rc == AIRSPYHF_SUCCESS) { - qDebug("AirspyHFThread::run: stopped Airspy Rx"); + qDebug("AirspyHFFThread::run: stopped Airspy HF Rx"); } else { - qDebug("AirspyHFThread::run: failed to stop Airspy Rx"); + qDebug("AirspyHFFThread::run: failed to stop Airspy HF Rx"); } m_running = false; } // Decimate according to specified log2 (ex: log2=4 => decim=16) -void AirspyHFThread::callback(const qint16* buf, qint32 len) +void AirspyHFThread::callback(const float* buf, qint32 len) { SampleVector::iterator it = m_convertBuffer.begin(); @@ -137,7 +136,7 @@ void AirspyHFThread::callback(const qint16* buf, qint32 len) int AirspyHFThread::rx_callback(airspyhf_transfer_t* transfer) { - qint32 bytes_to_write = transfer->sample_count * sizeof(qint16); - m_this->callback((qint16 *) transfer->samples, bytes_to_write); + qint32 nbIAndQ = transfer->sample_count * 2; + m_this->callback((float *) transfer->samples, nbIAndQ); return 0; } diff --git a/plugins/samplesource/airspyhf/airspyhfthread.h b/plugins/samplesource/airspyhf/airspyhfthread.h index 615bf8275..9b7ab98ba 100644 --- a/plugins/samplesource/airspyhf/airspyhfthread.h +++ b/plugins/samplesource/airspyhf/airspyhfthread.h @@ -23,7 +23,7 @@ #include #include "dsp/samplesinkfifo.h" -#include "dsp/decimators.h" +#include "dsp/decimatorsf.h" #define AIRSPYHF_BLOCKSIZE (1<<17) @@ -53,14 +53,10 @@ private: unsigned int m_log2Decim; static AirspyHFThread *m_this; -#ifdef SDR_RX_SAMPLE_24BIT - Decimators m_decimators; -#else - Decimators m_decimators; -#endif + DecimatorsF m_decimators; void run(); - void callback(const qint16* buf, qint32 len); + void callback(const float* buf, qint32 len); static int rx_callback(airspyhf_transfer_t* transfer); }; diff --git a/plugins/samplesource/airspyhff/CMakeLists.txt b/plugins/samplesource/airspyhfi/CMakeLists.txt similarity index 53% rename from plugins/samplesource/airspyhff/CMakeLists.txt rename to plugins/samplesource/airspyhfi/CMakeLists.txt index 9ce86ec97..f03cd4ff8 100644 --- a/plugins/samplesource/airspyhff/CMakeLists.txt +++ b/plugins/samplesource/airspyhfi/CMakeLists.txt @@ -1,25 +1,25 @@ -project(airspyhff) +project(airspyhfi) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -set(airspyhff_SOURCES - airspyhffgui.cpp - airspyhffinput.cpp - airspyhffplugin.cpp - airspyhffsettings.cpp - airspyhffthread.cpp +set(airspyhfi_SOURCES + airspyhfigui.cpp + airspyhfiinput.cpp + airspyhfiplugin.cpp + airspyhfisettings.cpp + airspyhfithread.cpp ) -set(airspyhff_HEADERS - airspyhffgui.h - airspyhffinput.h - airspyhffplugin.h - airspyhffsettings.h - airspyhffthread.h +set(airspyhfi_HEADERS + airspyhfigui.h + airspyhfiinput.h + airspyhfiplugin.h + airspyhfisettings.h + airspyhfithread.h ) -set(airspyhff_FORMS - airspyhffgui.ui +set(airspyhfi_FORMS + airspyhfigui.ui ) if (BUILD_DEBIAN) @@ -45,25 +45,25 @@ add_definitions("${QT_DEFINITIONS} -DLIBAIRSPY_DYN_RATES") add_definitions(-DQT_PLUGIN) add_definitions(-DQT_SHARED) -#qt4_wrap_cpp(airspyhff_HEADERS_MOC ${airspyhff_HEADERS}) -qt5_wrap_ui(airspyhff_FORMS_HEADERS ${airspyhff_FORMS}) +#qt4_wrap_cpp(airspyhf_HEADERS_MOC ${airspyhf_HEADERS}) +qt5_wrap_ui(airspyhfi_FORMS_HEADERS ${airspyhfi_FORMS}) -add_library(inputairspyhff SHARED - ${airspyhff_SOURCES} - ${airspyhff_HEADERS_MOC} - ${airspyhff_FORMS_HEADERS} +add_library(inputairspyhfi SHARED + ${airspyhfi_SOURCES} + ${airspyhfi_HEADERS_MOC} + ${airspyhfi_FORMS_HEADERS} ) if (BUILD_DEBIAN) -target_link_libraries(inputairspyhff +target_link_libraries(inputairspyhfi ${QT_LIBRARIES} - airspyhff + airspyhf sdrbase sdrgui swagger ) else (BUILD_DEBIAN) -target_link_libraries(inputairspyhff +target_link_libraries(inputairspyhfi ${QT_LIBRARIES} ${LIBAIRSPYHF_LIBRARIES} sdrbase @@ -73,6 +73,6 @@ target_link_libraries(inputairspyhff endif (BUILD_DEBIAN) -qt5_use_modules(inputairspyhff Core Widgets) +qt5_use_modules(inputairspyhfi Core Widgets) -install(TARGETS inputairspyhff DESTINATION lib/plugins/samplesource) +install(TARGETS inputairspyhfi DESTINATION lib/plugins/samplesource) diff --git a/plugins/samplesource/airspyhff/airspyhff.pro b/plugins/samplesource/airspyhfi/airspyhfi.pro similarity index 78% rename from plugins/samplesource/airspyhff/airspyhff.pro rename to plugins/samplesource/airspyhfi/airspyhfi.pro index c16537701..547c86b8e 100644 --- a/plugins/samplesource/airspyhff/airspyhff.pro +++ b/plugins/samplesource/airspyhfi/airspyhfi.pro @@ -9,7 +9,7 @@ CONFIG += plugin QT += core gui widgets multimedia opengl -TARGET = inputairspyhff +TARGET = inputairspyhfi CONFIG(MINGW32):LIBAIRSPYHFSRC = "D:\softs\airspyhf" CONFIG(MINGW64):LIBAIRSPYHFSRC = "D:\softs\airspyhf" @@ -28,19 +28,19 @@ QMAKE_CXXFLAGS += -std=c++11 CONFIG(Release):build_subdir = release CONFIG(Debug):build_subdir = debug -SOURCES += airspyhffgui.cpp\ - airspyhffinput.cpp\ - airspyhffplugin.cpp\ - airspyhffsettings.cpp\ - airspyhffthread.cpp +SOURCES += airspyhfigui.cpp\ + airspyhfiinput.cpp\ + airspyhfiplugin.cpp\ + airspyhfisettings.cpp\ + airspyhfithread.cpp -HEADERS += airspyhffgui.h\ - airspyhffinput.h\ - airspyhffplugin.h\ - airspyhffsettings.h\ - airspyhffthread.h +HEADERS += airspyhfigui.h\ + airspyhfiinput.h\ + airspyhfiplugin.h\ + airspyhfisettings.h\ + airspyhfithread.h -FORMS += airspyhffgui.ui +FORMS += airspyhfigui.ui LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase LIBS += -L../../../sdrgui/$${build_subdir} -lsdrgui diff --git a/plugins/samplesource/airspyhff/airspyhffgui.cpp b/plugins/samplesource/airspyhfi/airspyhfigui.cpp similarity index 77% rename from plugins/samplesource/airspyhff/airspyhffgui.cpp rename to plugins/samplesource/airspyhfi/airspyhfigui.cpp index 333ab41e0..20c3d9a8c 100644 --- a/plugins/samplesource/airspyhff/airspyhffgui.cpp +++ b/plugins/samplesource/airspyhfi/airspyhfigui.cpp @@ -23,16 +23,16 @@ #include "device/deviceuiset.h" #include -#include "ui_airspyhffgui.h" +#include "ui_airspyhfigui.h" #include "gui/colormapper.h" #include "gui/glspectrum.h" #include "dsp/dspengine.h" #include "dsp/dspcommands.h" -#include "airspyhffgui.h" +#include "airspyhfigui.h" -AirspyHFFGui::AirspyHFFGui(DeviceUISet *deviceUISet, QWidget* parent) : +AirspyHFIGui::AirspyHFIGui(DeviceUISet *deviceUISet, QWidget* parent) : QWidget(parent), - ui(new Ui::AirspyHFFGui), + ui(new Ui::AirspyHFIGui), m_deviceUISet(deviceUISet), m_doApplySettings(true), m_forceSettings(true), @@ -40,7 +40,7 @@ AirspyHFFGui::AirspyHFFGui(DeviceUISet *deviceUISet, QWidget* parent) : m_sampleSource(0), m_lastEngineState((DSPDeviceSourceEngine::State)-1) { - m_sampleSource = (AirspyHFFInput*) m_deviceUISet->m_deviceSourceAPI->getSampleSource(); + m_sampleSource = (AirspyHFIInput*) m_deviceUISet->m_deviceSourceAPI->getSampleSource(); ui->setupUi(this); ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); @@ -52,58 +52,58 @@ AirspyHFFGui::AirspyHFFGui(DeviceUISet *deviceUISet, QWidget* parent) : displaySettings(); - m_rates = ((AirspyHFFInput*) m_sampleSource)->getSampleRates(); + m_rates = ((AirspyHFIInput*) m_sampleSource)->getSampleRates(); displaySampleRates(); connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection); sendSettings(); } -AirspyHFFGui::~AirspyHFFGui() +AirspyHFIGui::~AirspyHFIGui() { delete ui; } -void AirspyHFFGui::destroy() +void AirspyHFIGui::destroy() { delete this; } -void AirspyHFFGui::setName(const QString& name) +void AirspyHFIGui::setName(const QString& name) { setObjectName(name); } -QString AirspyHFFGui::getName() const +QString AirspyHFIGui::getName() const { return objectName(); } -void AirspyHFFGui::resetToDefaults() +void AirspyHFIGui::resetToDefaults() { m_settings.resetToDefaults(); displaySettings(); sendSettings(); } -qint64 AirspyHFFGui::getCenterFrequency() const +qint64 AirspyHFIGui::getCenterFrequency() const { return m_settings.m_centerFrequency; } -void AirspyHFFGui::setCenterFrequency(qint64 centerFrequency) +void AirspyHFIGui::setCenterFrequency(qint64 centerFrequency) { m_settings.m_centerFrequency = centerFrequency; displaySettings(); sendSettings(); } -QByteArray AirspyHFFGui::serialize() const +QByteArray AirspyHFIGui::serialize() const { return m_settings.serialize(); } -bool AirspyHFFGui::deserialize(const QByteArray& data) +bool AirspyHFIGui::deserialize(const QByteArray& data) { if(m_settings.deserialize(data)) { displaySettings(); @@ -116,20 +116,20 @@ bool AirspyHFFGui::deserialize(const QByteArray& data) } } -bool AirspyHFFGui::handleMessage(const Message& message) +bool AirspyHFIGui::handleMessage(const Message& message) { - if (AirspyHFFInput::MsgConfigureAirspyHF::match(message)) + if (AirspyHFIInput::MsgConfigureAirspyHFI::match(message)) { - const AirspyHFFInput::MsgConfigureAirspyHF& cfg = (AirspyHFFInput::MsgConfigureAirspyHF&) message; + const AirspyHFIInput::MsgConfigureAirspyHFI& cfg = (AirspyHFIInput::MsgConfigureAirspyHFI&) message; m_settings = cfg.getSettings(); blockApplySettings(true); displaySettings(); blockApplySettings(false); return true; } - else if (AirspyHFFInput::MsgStartStop::match(message)) + else if (AirspyHFIInput::MsgStartStop::match(message)) { - AirspyHFFInput::MsgStartStop& notif = (AirspyHFFInput::MsgStartStop&) message; + AirspyHFIInput::MsgStartStop& notif = (AirspyHFIInput::MsgStartStop&) message; blockApplySettings(true); ui->startStop->setChecked(notif.getStartStop()); blockApplySettings(false); @@ -142,7 +142,7 @@ bool AirspyHFFGui::handleMessage(const Message& message) } } -void AirspyHFFGui::handleInputMessages() +void AirspyHFIGui::handleInputMessages() { Message* message; @@ -170,14 +170,14 @@ void AirspyHFFGui::handleInputMessages() } } -void AirspyHFFGui::updateSampleRateAndFrequency() +void AirspyHFIGui::updateSampleRateAndFrequency() { m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate); m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency); ui->deviceRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000)); } -void AirspyHFFGui::updateFrequencyLimits() +void AirspyHFIGui::updateFrequencyLimits() { // values in kHz qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0; @@ -188,13 +188,13 @@ void AirspyHFFGui::updateFrequencyLimits() switch(m_settings.m_bandIndex) { case 1: - minLimit = AirspyHFFInput::loLowLimitFreqVHF/1000 + deltaFrequency; - maxLimit = AirspyHFFInput::loHighLimitFreqVHF/1000 + deltaFrequency; + minLimit = AirspyHFIInput::loLowLimitFreqVHF/1000 + deltaFrequency; + maxLimit = AirspyHFIInput::loHighLimitFreqVHF/1000 + deltaFrequency; break; case 0: default: - minLimit = AirspyHFFInput::loLowLimitFreqHF/1000 + deltaFrequency; - maxLimit = AirspyHFFInput::loHighLimitFreqHF/1000 + deltaFrequency; + minLimit = AirspyHFIInput::loLowLimitFreqHF/1000 + deltaFrequency; + maxLimit = AirspyHFIInput::loHighLimitFreqHF/1000 + deltaFrequency; break; } @@ -206,7 +206,7 @@ void AirspyHFFGui::updateFrequencyLimits() ui->centerFrequency->setValueRange(7, minLimit, maxLimit); } -void AirspyHFFGui::displaySettings() +void AirspyHFIGui::displaySettings() { blockApplySettings(true); ui->band->blockSignals(true); @@ -218,13 +218,14 @@ void AirspyHFFGui::displaySettings() ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); ui->LOppm->setValue(m_settings.m_LOppmTenths); ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1))); + ui->autoCorr->setCurrentIndex(m_settings.m_autoCorrOptions); ui->sampleRate->setCurrentIndex(m_settings.m_devSampleRateIndex); ui->decim->setCurrentIndex(m_settings.m_log2Decim); ui->band->blockSignals(false); blockApplySettings(false); } -void AirspyHFFGui::displaySampleRates() +void AirspyHFIGui::displaySampleRates() { unsigned int savedIndex = m_settings.m_devSampleRateIndex; ui->sampleRate->blockSignals(true); @@ -252,37 +253,47 @@ void AirspyHFFGui::displaySampleRates() } } -void AirspyHFFGui::sendSettings() +void AirspyHFIGui::sendSettings() { if(!m_updateTimer.isActive()) m_updateTimer.start(100); } -void AirspyHFFGui::on_centerFrequency_changed(quint64 value) +void AirspyHFIGui::on_centerFrequency_changed(quint64 value) { m_settings.m_centerFrequency = value * 1000; sendSettings(); } -void AirspyHFFGui::on_LOppm_valueChanged(int value) +void AirspyHFIGui::on_LOppm_valueChanged(int value) { m_settings.m_LOppmTenths = value; ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1))); sendSettings(); } -void AirspyHFFGui::on_resetLOppm_clicked() +void AirspyHFIGui::on_resetLOppm_clicked() { ui->LOppm->setValue(0); } -void AirspyHFFGui::on_sampleRate_currentIndexChanged(int index) +void AirspyHFIGui::on_autoCorr_currentIndexChanged(int index) +{ + if ((index < 0) || (index > AirspyHFISettings::AutoCorrLast)) { + return; + } + + m_settings.m_autoCorrOptions = (AirspyHFISettings::AutoCorrOptions) index; + sendSettings(); +} + +void AirspyHFIGui::on_sampleRate_currentIndexChanged(int index) { m_settings.m_devSampleRateIndex = index; sendSettings(); } -void AirspyHFFGui::on_decim_currentIndexChanged(int index) +void AirspyHFIGui::on_decim_currentIndexChanged(int index) { if ((index < 0) || (index > 5)) return; @@ -290,16 +301,16 @@ void AirspyHFFGui::on_decim_currentIndexChanged(int index) sendSettings(); } -void AirspyHFFGui::on_startStop_toggled(bool checked) +void AirspyHFIGui::on_startStop_toggled(bool checked) { if (m_doApplySettings) { - AirspyHFFInput::MsgStartStop *message = AirspyHFFInput::MsgStartStop::create(checked); + AirspyHFIInput::MsgStartStop *message = AirspyHFIInput::MsgStartStop::create(checked); m_sampleSource->getInputMessageQueue()->push(message); } } -void AirspyHFFGui::on_record_toggled(bool checked) +void AirspyHFIGui::on_record_toggled(bool checked) { if (checked) { ui->record->setStyleSheet("QToolButton { background-color : red; }"); @@ -307,11 +318,11 @@ void AirspyHFFGui::on_record_toggled(bool checked) ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); } - AirspyHFFInput::MsgFileRecord* message = AirspyHFFInput::MsgFileRecord::create(checked); + AirspyHFIInput::MsgFileRecord* message = AirspyHFIInput::MsgFileRecord::create(checked); m_sampleSource->getInputMessageQueue()->push(message); } -void AirspyHFFGui::on_transverter_clicked() +void AirspyHFIGui::on_transverter_clicked() { m_settings.m_transverterMode = ui->transverter->getDeltaFrequencyAcive(); m_settings.m_transverterDeltaFrequency = ui->transverter->getDeltaFrequency(); @@ -321,7 +332,7 @@ void AirspyHFFGui::on_transverter_clicked() sendSettings(); } -void AirspyHFFGui::on_band_currentIndexChanged(int index) +void AirspyHFIGui::on_band_currentIndexChanged(int index) { if ((index < 0) || (index > 1)) { return; @@ -334,16 +345,16 @@ void AirspyHFFGui::on_band_currentIndexChanged(int index) sendSettings(); } -void AirspyHFFGui::updateHardware() +void AirspyHFIGui::updateHardware() { qDebug() << "AirspyHFGui::updateHardware"; - AirspyHFFInput::MsgConfigureAirspyHF* message = AirspyHFFInput::MsgConfigureAirspyHF::create(m_settings, m_forceSettings); + AirspyHFIInput::MsgConfigureAirspyHFI* message = AirspyHFIInput::MsgConfigureAirspyHFI::create(m_settings, m_forceSettings); m_sampleSource->getInputMessageQueue()->push(message); m_forceSettings = false; m_updateTimer.stop(); } -void AirspyHFFGui::updateStatus() +void AirspyHFIGui::updateStatus() { int state = m_deviceUISet->m_deviceSourceAPI->state(); @@ -372,7 +383,7 @@ void AirspyHFFGui::updateStatus() } } -uint32_t AirspyHFFGui::getDevSampleRate(unsigned int rate_index) +uint32_t AirspyHFIGui::getDevSampleRate(unsigned int rate_index) { if (rate_index < m_rates.size()) { @@ -384,7 +395,7 @@ uint32_t AirspyHFFGui::getDevSampleRate(unsigned int rate_index) } } -int AirspyHFFGui::getDevSampleRateIndex(uint32_t sampeRate) +int AirspyHFIGui::getDevSampleRateIndex(uint32_t sampeRate) { for (unsigned int i=0; i < m_rates.size(); i++) { diff --git a/plugins/samplesource/airspyhff/airspyhffgui.h b/plugins/samplesource/airspyhfi/airspyhfigui.h similarity index 87% rename from plugins/samplesource/airspyhff/airspyhffgui.h rename to plugins/samplesource/airspyhfi/airspyhfigui.h index 8815d5e5c..537714667 100644 --- a/plugins/samplesource/airspyhff/airspyhffgui.h +++ b/plugins/samplesource/airspyhfi/airspyhfigui.h @@ -14,8 +14,8 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#ifndef INCLUDE_AIRSPYHFFGUI_H -#define INCLUDE_AIRSPYHFFGUI_H +#ifndef INCLUDE_AIRSPYHFIGUI_H +#define INCLUDE_AIRSPYHFIGUI_H #include #include @@ -23,21 +23,21 @@ #include "util/messagequeue.h" -#include "airspyhffinput.h" +#include "airspyhfiinput.h" class DeviceUISet; namespace Ui { - class AirspyHFFGui; - class AirspyHFFSampleRates; + class AirspyHFIGui; + class AirspyHFISampleRates; } -class AirspyHFFGui : public QWidget, public PluginInstanceGUI { +class AirspyHFIGui : public QWidget, public PluginInstanceGUI { Q_OBJECT public: - explicit AirspyHFFGui(DeviceUISet *deviceUISet, QWidget* parent = 0); - virtual ~AirspyHFFGui(); + explicit AirspyHFIGui(DeviceUISet *deviceUISet, QWidget* parent = 0); + virtual ~AirspyHFIGui(); virtual void destroy(); void setName(const QString& name); @@ -54,12 +54,12 @@ public: int getDevSampleRateIndex(uint32_t sampleRate); private: - Ui::AirspyHFFGui* ui; + Ui::AirspyHFIGui* ui; DeviceUISet* m_deviceUISet; bool m_doApplySettings; bool m_forceSettings; - AirspyHFFSettings m_settings; + AirspyHFISettings m_settings; QTimer m_updateTimer; QTimer m_statusTimer; std::vector m_rates; @@ -80,6 +80,7 @@ private slots: void on_centerFrequency_changed(quint64 value); void on_LOppm_valueChanged(int value); void on_resetLOppm_clicked(); + void on_autoCorr_currentIndexChanged(int index); void on_sampleRate_currentIndexChanged(int index); void on_decim_currentIndexChanged(int index); void on_startStop_toggled(bool checked); @@ -91,4 +92,4 @@ private slots: void handleInputMessages(); }; -#endif // INCLUDE_AIRSPYHFGUI_H +#endif // INCLUDE_AIRSPYHFIGUI_H diff --git a/plugins/samplesource/airspyhff/airspyhffgui.ui b/plugins/samplesource/airspyhfi/airspyhfigui.ui similarity index 90% rename from plugins/samplesource/airspyhff/airspyhffgui.ui rename to plugins/samplesource/airspyhfi/airspyhfigui.ui index 218765a3c..18a142606 100644 --- a/plugins/samplesource/airspyhff/airspyhffgui.ui +++ b/plugins/samplesource/airspyhfi/airspyhfigui.ui @@ -1,13 +1,13 @@ - AirspyHFFGui - + AirspyHFIGui + 0 0 324 - 132 + 174 @@ -237,6 +237,52 @@ + + + + + + Corr + + + + + + + DC offset and IQ correction options + + + + None + + + + + DC + + + + + DC+IQ + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + diff --git a/plugins/samplesource/airspyhff/airspyhffinput.cpp b/plugins/samplesource/airspyhfi/airspyhfiinput.cpp similarity index 75% rename from plugins/samplesource/airspyhff/airspyhffinput.cpp rename to plugins/samplesource/airspyhfi/airspyhfiinput.cpp index e525c17dc..1b34075e3 100644 --- a/plugins/samplesource/airspyhff/airspyhffinput.cpp +++ b/plugins/samplesource/airspyhfi/airspyhfiinput.cpp @@ -26,28 +26,28 @@ #include "dsp/dspcommands.h" #include "dsp/dspengine.h" -#include "airspyhffinput.h" +#include "airspyhfisettings.h" +#include "airspyhfiinput.h" -#include "airspyhffgui.h" -#include "airspyhffplugin.h" -#include "airspyhffsettings.h" -#include "airspyhffthread.h" +#include "airspyhfiplugin.h" +#include "airspyhfithread.h" +#include "airspyhfigui.h" -MESSAGE_CLASS_DEFINITION(AirspyHFFInput::MsgConfigureAirspyHF, Message) -MESSAGE_CLASS_DEFINITION(AirspyHFFInput::MsgStartStop, Message) -MESSAGE_CLASS_DEFINITION(AirspyHFFInput::MsgFileRecord, Message) +MESSAGE_CLASS_DEFINITION(AirspyHFIInput::MsgConfigureAirspyHFI, Message) +MESSAGE_CLASS_DEFINITION(AirspyHFIInput::MsgStartStop, Message) +MESSAGE_CLASS_DEFINITION(AirspyHFIInput::MsgFileRecord, Message) -const qint64 AirspyHFFInput::loLowLimitFreqHF = 9000L; -const qint64 AirspyHFFInput::loHighLimitFreqHF = 31000000L; -const qint64 AirspyHFFInput::loLowLimitFreqVHF = 60000000L; -const qint64 AirspyHFFInput::loHighLimitFreqVHF = 260000000L; +const qint64 AirspyHFIInput::loLowLimitFreqHF = 9000L; +const qint64 AirspyHFIInput::loHighLimitFreqHF = 31000000L; +const qint64 AirspyHFIInput::loLowLimitFreqVHF = 60000000L; +const qint64 AirspyHFIInput::loHighLimitFreqVHF = 260000000L; -AirspyHFFInput::AirspyHFFInput(DeviceSourceAPI *deviceAPI) : +AirspyHFIInput::AirspyHFIInput(DeviceSourceAPI *deviceAPI) : m_deviceAPI(deviceAPI), m_settings(), m_dev(0), m_airspyHFThread(0), - m_deviceDescription("AirspyHFF"), + m_deviceDescription("AirspyHFI"), m_running(false) { openDevice(); @@ -58,7 +58,7 @@ AirspyHFFInput::AirspyHFFInput(DeviceSourceAPI *deviceAPI) : m_deviceAPI->addSink(m_fileSink); } -AirspyHFFInput::~AirspyHFFInput() +AirspyHFIInput::~AirspyHFIInput() { if (m_running) { stop(); } m_deviceAPI->removeSink(m_fileSink); @@ -66,12 +66,12 @@ AirspyHFFInput::~AirspyHFFInput() closeDevice(); } -void AirspyHFFInput::destroy() +void AirspyHFIInput::destroy() { delete this; } -bool AirspyHFFInput::openDevice() +bool AirspyHFIInput::openDevice() { if (m_dev != 0) { @@ -82,18 +82,18 @@ bool AirspyHFFInput::openDevice() if (!m_sampleFifo.setSize(1<<19)) { - qCritical("AirspyHFFInput::start: could not allocate SampleFifo"); + qCritical("AirspyHFInput::start: could not allocate SampleFifo"); return false; } if ((m_dev = open_airspyhf_from_serial(m_deviceAPI->getSampleSourceSerial())) == 0) { - qCritical("AirspyHFFInput::start: could not open Airspy HF with serial %s", qPrintable(m_deviceAPI->getSampleSourceSerial())); + qCritical("AirspyHFInput::start: could not open Airspy with serial %s", qPrintable(m_deviceAPI->getSampleSourceSerial())); return false; } else { - qDebug("AirspyHFFInput::start: opened Airspy HF with serial %s", qPrintable(m_deviceAPI->getSampleSourceSerial())); + qDebug("AirspyHFInput::start: opened Airspy with serial %s", qPrintable(m_deviceAPI->getSampleSourceSerial())); } uint32_t nbSampleRates; @@ -103,11 +103,11 @@ bool AirspyHFFInput::openDevice() if (rc == AIRSPYHF_SUCCESS) { - qDebug("AirspyHFFInput::start: %d sample rates for Airspy HF", nbSampleRates); + qDebug("AirspyHFInput::start: %d sample rates for AirspyHF", nbSampleRates); } else { - qCritical("AirspyHFFInput::start: could not obtain the number of Airspy HF sample rates"); + qCritical("AirspyHFInput::start: could not obtain the number of AirspyHF sample rates"); return false; } @@ -117,11 +117,11 @@ bool AirspyHFFInput::openDevice() if (rc == AIRSPYHF_SUCCESS) { - qDebug("AirspyHFFInput::start: obtained Airspy HF sample rates"); + qDebug("AirspyHFInput::start: obtained AirspyHF sample rates"); } else { - qCritical("AirspyHFFInput::start: could not obtain Airspy HF sample rates"); + qCritical("AirspyHFInput::start: could not obtain AirspyHF sample rates"); return false; } @@ -130,22 +130,22 @@ bool AirspyHFFInput::openDevice() for (unsigned int i = 0; i < nbSampleRates; i++) { m_sampleRates.push_back(sampleRates[i]); - qDebug("AirspyHFFInput::start: sampleRates[%d] = %u Hz", i, sampleRates[i]); + qDebug("AirspyHFInput::start: sampleRates[%d] = %u Hz", i, sampleRates[i]); } delete[] sampleRates; - airspyhf_set_sample_type(m_dev, AIRSPYHF_SAMPLE_FLOAT32_IQ); + airspyhf_set_sample_type(m_dev, AIRSPYHF_SAMPLE_INT16_NDSP_IQ); return true; } -void AirspyHFFInput::init() +void AirspyHFIInput::init() { applySettings(m_settings, true); } -bool AirspyHFFInput::start() +bool AirspyHFIInput::start() { QMutexLocker mutexLocker(&m_mutex); @@ -155,7 +155,7 @@ bool AirspyHFFInput::start() if (m_running) { stop(); } - if ((m_airspyHFThread = new AirspyHFFThread(m_dev, &m_sampleFifo)) == 0) + if ((m_airspyHFThread = new AirspyHFIThread(m_dev, &m_sampleFifo)) == 0) { qFatal("AirspyHFInput::start: out of memory"); stop(); @@ -177,7 +177,7 @@ bool AirspyHFFInput::start() return true; } -void AirspyHFFInput::closeDevice() +void AirspyHFIInput::closeDevice() { if (m_dev != 0) { @@ -189,7 +189,7 @@ void AirspyHFFInput::closeDevice() m_deviceDescription.clear(); } -void AirspyHFFInput::stop() +void AirspyHFIInput::stop() { qDebug("AirspyHFInput::stop"); QMutexLocker mutexLocker(&m_mutex); @@ -204,12 +204,12 @@ void AirspyHFFInput::stop() m_running = false; } -QByteArray AirspyHFFInput::serialize() const +QByteArray AirspyHFIInput::serialize() const { return m_settings.serialize(); } -bool AirspyHFFInput::deserialize(const QByteArray& data) +bool AirspyHFIInput::deserialize(const QByteArray& data) { bool success = true; @@ -219,54 +219,54 @@ bool AirspyHFFInput::deserialize(const QByteArray& data) success = false; } - MsgConfigureAirspyHF* message = MsgConfigureAirspyHF::create(m_settings, true); + MsgConfigureAirspyHFI* message = MsgConfigureAirspyHFI::create(m_settings, true); m_inputMessageQueue.push(message); if (m_guiMessageQueue) { - MsgConfigureAirspyHF* messageToGUI = MsgConfigureAirspyHF::create(m_settings, true); + MsgConfigureAirspyHFI* messageToGUI = MsgConfigureAirspyHFI::create(m_settings, true); m_guiMessageQueue->push(messageToGUI); } return success; } -const QString& AirspyHFFInput::getDeviceDescription() const +const QString& AirspyHFIInput::getDeviceDescription() const { return m_deviceDescription; } -int AirspyHFFInput::getSampleRate() const +int AirspyHFIInput::getSampleRate() const { int rate = m_sampleRates[m_settings.m_devSampleRateIndex]; return (rate / (1<push(messageToGUI); } } -bool AirspyHFFInput::handleMessage(const Message& message) +bool AirspyHFIInput::handleMessage(const Message& message) { - if (MsgConfigureAirspyHF::match(message)) + if (MsgConfigureAirspyHFI::match(message)) { - MsgConfigureAirspyHF& conf = (MsgConfigureAirspyHF&) message; + MsgConfigureAirspyHFI& conf = (MsgConfigureAirspyHFI&) message; qDebug() << "MsgConfigureAirspyHF::handleMessage: MsgConfigureAirspyHF"; bool success = applySettings(conf.getSettings(), conf.getForce()); @@ -318,7 +318,7 @@ bool AirspyHFFInput::handleMessage(const Message& message) } } -void AirspyHFFInput::setDeviceCenterFrequency(quint64 freq_hz, const AirspyHFFSettings& settings) +void AirspyHFIInput::setDeviceCenterFrequency(quint64 freq_hz, const AirspyHFISettings& settings) { switch(settings.m_bandIndex) { @@ -340,7 +340,7 @@ void AirspyHFFInput::setDeviceCenterFrequency(quint64 freq_hz, const AirspyHFFSe } } -bool AirspyHFFInput::applySettings(const AirspyHFFSettings& settings, bool force) +bool AirspyHFIInput::applySettings(const AirspyHFISettings& settings, bool force) { QMutexLocker mutexLocker(&m_mutex); @@ -350,6 +350,23 @@ bool AirspyHFFInput::applySettings(const AirspyHFFSettings& settings, bool force qDebug() << "AirspyHFInput::applySettings"; + if ((m_settings.m_autoCorrOptions != settings.m_autoCorrOptions) || force) + { + switch(settings.m_autoCorrOptions) + { + case AirspyHFISettings::AutoCorrDC: + m_deviceAPI->configureCorrections(true, false); + break; + case AirspyHFISettings::AutoCorrDCAndIQ: + m_deviceAPI->configureCorrections(true, true); + break; + case AirspyHFISettings::AutoCorrNone: + default: + m_deviceAPI->configureCorrections(false, false); + break; + } + } + if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force) { forwardChange = true; @@ -439,7 +456,7 @@ bool AirspyHFFInput::applySettings(const AirspyHFFSettings& settings, bool force return true; } -airspyhf_device_t *AirspyHFFInput::open_airspyhf_from_serial(const QString& serialStr) +airspyhf_device_t *AirspyHFIInput::open_airspyhf_from_serial(const QString& serialStr) { airspyhf_device_t *devinfo; bool ok; @@ -464,7 +481,7 @@ airspyhf_device_t *AirspyHFFInput::open_airspyhf_from_serial(const QString& seri } } -int AirspyHFFInput::webapiRunGet( +int AirspyHFIInput::webapiRunGet( SWGSDRangel::SWGDeviceState& response, QString& errorMessage __attribute__((unused))) { @@ -472,7 +489,7 @@ int AirspyHFFInput::webapiRunGet( return 200; } -int AirspyHFFInput::webapiRun( +int AirspyHFIInput::webapiRun( bool run, SWGSDRangel::SWGDeviceState& response, QString& errorMessage __attribute__((unused))) diff --git a/plugins/samplesource/airspyhff/airspyhffinput.h b/plugins/samplesource/airspyhfi/airspyhfiinput.h similarity index 82% rename from plugins/samplesource/airspyhff/airspyhffinput.h rename to plugins/samplesource/airspyhfi/airspyhfiinput.h index 286a81648..d0d0bbf99 100644 --- a/plugins/samplesource/airspyhff/airspyhffinput.h +++ b/plugins/samplesource/airspyhfi/airspyhfiinput.h @@ -14,8 +14,8 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#ifndef INCLUDE_AIRSPYHFFINPUT_H -#define INCLUDE_AIRSPYHFFINPUT_H +#ifndef INCLUDE_AIRSPYHFIINPUT_H +#define INCLUDE_AIRSPYHFIINPUT_H #include #include @@ -23,31 +23,31 @@ #include #include -#include "airspyhffsettings.h" +#include "airspyhfisettings.h" class DeviceSourceAPI; -class AirspyHFFThread; +class AirspyHFIThread; class FileRecord; -class AirspyHFFInput : public DeviceSampleSource { +class AirspyHFIInput : public DeviceSampleSource { public: - class MsgConfigureAirspyHF : public Message { + class MsgConfigureAirspyHFI : public Message { MESSAGE_CLASS_DECLARATION public: - const AirspyHFFSettings& getSettings() const { return m_settings; } + const AirspyHFISettings& getSettings() const { return m_settings; } bool getForce() const { return m_force; } - static MsgConfigureAirspyHF* create(const AirspyHFFSettings& settings, bool force) + static MsgConfigureAirspyHFI* create(const AirspyHFISettings& settings, bool force) { - return new MsgConfigureAirspyHF(settings, force); + return new MsgConfigureAirspyHFI(settings, force); } private: - AirspyHFFSettings m_settings; + AirspyHFISettings m_settings; bool m_force; - MsgConfigureAirspyHF(const AirspyHFFSettings& settings, bool force) : + MsgConfigureAirspyHFI(const AirspyHFISettings& settings, bool force) : Message(), m_settings(settings), m_force(force) @@ -92,8 +92,8 @@ public: { } }; - AirspyHFFInput(DeviceSourceAPI *deviceAPI); - virtual ~AirspyHFFInput(); + AirspyHFIInput(DeviceSourceAPI *deviceAPI); + virtual ~AirspyHFIInput(); virtual void destroy(); virtual void init(); @@ -129,19 +129,19 @@ public: private: bool openDevice(); void closeDevice(); - bool applySettings(const AirspyHFFSettings& settings, bool force); + bool applySettings(const AirspyHFISettings& settings, bool force); airspyhf_device_t *open_airspyhf_from_serial(const QString& serialStr); - void setDeviceCenterFrequency(quint64 freq, const AirspyHFFSettings& settings); + void setDeviceCenterFrequency(quint64 freq, const AirspyHFISettings& settings); DeviceSourceAPI *m_deviceAPI; QMutex m_mutex; - AirspyHFFSettings m_settings; + AirspyHFISettings m_settings; airspyhf_device_t* m_dev; - AirspyHFFThread* m_airspyHFThread; + AirspyHFIThread* m_airspyHFThread; QString m_deviceDescription; std::vector m_sampleRates; bool m_running; FileRecord *m_fileSink; //!< File sink to record device I/Q output }; -#endif // INCLUDE_AIRSPYHFFINPUT_H +#endif // INCLUDE_AIRSPYHFIINPUT_H diff --git a/plugins/samplesource/airspyhff/airspyhffplugin.cpp b/plugins/samplesource/airspyhfi/airspyhfiplugin.cpp similarity index 71% rename from plugins/samplesource/airspyhff/airspyhffplugin.cpp rename to plugins/samplesource/airspyhfi/airspyhfiplugin.cpp index 146e27063..2df26e08f 100644 --- a/plugins/samplesource/airspyhff/airspyhffplugin.cpp +++ b/plugins/samplesource/airspyhfi/airspyhfiplugin.cpp @@ -21,12 +21,13 @@ #include #include "plugin/pluginapi.h" #include "util/simpleserializer.h" -#include "airspyhffplugin.h" -#include "airspyhffgui.h" +#include "airspyhfiplugin.h" + +#include "airspyhfigui.h" -const PluginDescriptor AirspyHFFPlugin::m_pluginDescriptor = { - QString("AirspyHF Input (float)"), +const PluginDescriptor AirspyHFIPlugin::m_pluginDescriptor = { + QString("AirspyHF Input (int)"), QString("3.12.0"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), @@ -34,26 +35,26 @@ const PluginDescriptor AirspyHFFPlugin::m_pluginDescriptor = { QString("https://github.com/f4exb/sdrangel") }; -const QString AirspyHFFPlugin::m_hardwareID = "AirspyHFF"; -const QString AirspyHFFPlugin::m_deviceTypeID = AIRSPYHFF_DEVICE_TYPE_ID; -const int AirspyHFFPlugin::m_maxDevices = 32; +const QString AirspyHFIPlugin::m_hardwareID = "AirspyHFI"; +const QString AirspyHFIPlugin::m_deviceTypeID = AIRSPYHFI_DEVICE_TYPE_ID; +const int AirspyHFIPlugin::m_maxDevices = 32; -AirspyHFFPlugin::AirspyHFFPlugin(QObject* parent) : +AirspyHFIPlugin::AirspyHFIPlugin(QObject* parent) : QObject(parent) { } -const PluginDescriptor& AirspyHFFPlugin::getPluginDescriptor() const +const PluginDescriptor& AirspyHFIPlugin::getPluginDescriptor() const { return m_pluginDescriptor; } -void AirspyHFFPlugin::initPlugin(PluginAPI* pluginAPI) +void AirspyHFIPlugin::initPlugin(PluginAPI* pluginAPI) { pluginAPI->registerSampleSource(m_deviceTypeID, this); } -PluginInterface::SamplingDevices AirspyHFFPlugin::enumSampleSources() +PluginInterface::SamplingDevices AirspyHFIPlugin::enumSampleSources() { SamplingDevices result; int nbDevices; @@ -63,7 +64,7 @@ PluginInterface::SamplingDevices AirspyHFFPlugin::enumSampleSources() if (nbDevices < 0) { - qCritical("AirspyHFPlugin::enumSampleSources: failed to list Airspy HF devices"); + qCritical("AirspyHFIPlugin::enumSampleSources: failed to list Airspy HF devices"); } for (int i = 0; i < nbDevices; i++) @@ -71,7 +72,7 @@ PluginInterface::SamplingDevices AirspyHFFPlugin::enumSampleSources() if (deviceSerials[i]) { QString serial_str = QString::number(deviceSerials[i], 16); - QString displayedName(QString("AirspyHF(float)[%1] %2").arg(i).arg(serial_str)); + QString displayedName(QString("AirspyHF(int)[%1] %2").arg(i).arg(serial_str)); result.append(SamplingDevice(displayedName, m_hardwareID, @@ -83,11 +84,11 @@ PluginInterface::SamplingDevices AirspyHFFPlugin::enumSampleSources() 1, 0)); - qDebug("AirspyHFFPlugin::enumSampleSources: enumerated Airspy HF device #%d", i); + qDebug("AirspyHFIPlugin::enumSampleSources: enumerated Airspy device #%d", i); } else { - qDebug("AirspyHFFPlugin::enumSampleSources: finished to enumerate Airspy HF. %d devices found", i); + qDebug("AirspyHFIPlugin::enumSampleSources: finished to enumerate Airspy HF. %d devices found", i); break; // finished } } @@ -95,14 +96,14 @@ PluginInterface::SamplingDevices AirspyHFFPlugin::enumSampleSources() return result; } -PluginInstanceGUI* AirspyHFFPlugin::createSampleSourcePluginInstanceGUI( +PluginInstanceGUI* AirspyHFIPlugin::createSampleSourcePluginInstanceGUI( const QString& sourceId, QWidget **widget, DeviceUISet *deviceUISet) { if (sourceId == m_deviceTypeID) { - AirspyHFFGui* gui = new AirspyHFFGui(deviceUISet); + AirspyHFIGui* gui = new AirspyHFIGui(deviceUISet); *widget = gui; return gui; } @@ -112,11 +113,11 @@ PluginInstanceGUI* AirspyHFFPlugin::createSampleSourcePluginInstanceGUI( } } -DeviceSampleSource *AirspyHFFPlugin::createSampleSourcePluginInstanceInput(const QString& sourceId, DeviceSourceAPI *deviceAPI) +DeviceSampleSource *AirspyHFIPlugin::createSampleSourcePluginInstanceInput(const QString& sourceId, DeviceSourceAPI *deviceAPI) { if (sourceId == m_deviceTypeID) { - AirspyHFFInput* input = new AirspyHFFInput(deviceAPI); + AirspyHFIInput* input = new AirspyHFIInput(deviceAPI); return input; } else diff --git a/plugins/samplesource/airspyhff/airspyhffplugin.h b/plugins/samplesource/airspyhfi/airspyhfiplugin.h similarity index 85% rename from plugins/samplesource/airspyhff/airspyhffplugin.h rename to plugins/samplesource/airspyhfi/airspyhfiplugin.h index 423ae6519..33b73bc69 100644 --- a/plugins/samplesource/airspyhff/airspyhffplugin.h +++ b/plugins/samplesource/airspyhfi/airspyhfiplugin.h @@ -14,23 +14,23 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#ifndef INCLUDE_AIRSPYHFFPLUGIN_H -#define INCLUDE_AIRSPYHFFPLUGIN_H +#ifndef INCLUDE_AIRSPYHFIPLUGIN_H +#define INCLUDE_AIRSPYHFIPLUGIN_H #include #include "plugin/plugininterface.h" -#define AIRSPYHFF_DEVICE_TYPE_ID "sdrangel.samplesource.airspyhff" +#define AIRSPYHFI_DEVICE_TYPE_ID "sdrangel.samplesource.airspyhfi" class PluginAPI; -class AirspyHFFPlugin : public QObject, public PluginInterface { +class AirspyHFIPlugin : public QObject, public PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) - Q_PLUGIN_METADATA(IID AIRSPYHFF_DEVICE_TYPE_ID) + Q_PLUGIN_METADATA(IID AIRSPYHFI_DEVICE_TYPE_ID) public: - explicit AirspyHFFPlugin(QObject* parent = 0); + explicit AirspyHFIPlugin(QObject* parent = 0); const PluginDescriptor& getPluginDescriptor() const; void initPlugin(PluginAPI* pluginAPI); @@ -50,4 +50,4 @@ private: static const PluginDescriptor m_pluginDescriptor; }; -#endif // INCLUDE_AIRSPYHFFPLUGIN_H +#endif // INCLUDE_AIRSPYHFIPLUGIN_H diff --git a/plugins/samplesource/airspyhff/airspyhffsettings.cpp b/plugins/samplesource/airspyhfi/airspyhfisettings.cpp similarity index 82% rename from plugins/samplesource/airspyhff/airspyhffsettings.cpp rename to plugins/samplesource/airspyhfi/airspyhfisettings.cpp index f09ee9c42..f0cc373d8 100644 --- a/plugins/samplesource/airspyhff/airspyhffsettings.cpp +++ b/plugins/samplesource/airspyhfi/airspyhfisettings.cpp @@ -16,15 +16,14 @@ #include #include "util/simpleserializer.h" +#include "airspyhfisettings.h" -#include "airspyhffsettings.h" - -AirspyHFFSettings::AirspyHFFSettings() +AirspyHFISettings::AirspyHFISettings() { resetToDefaults(); } -void AirspyHFFSettings::resetToDefaults() +void AirspyHFISettings::resetToDefaults() { m_centerFrequency = 7150*1000; m_LOppmTenths = 0; @@ -33,15 +32,17 @@ void AirspyHFFSettings::resetToDefaults() m_transverterMode = false; m_transverterDeltaFrequency = 0; m_bandIndex = 0; + m_autoCorrOptions = AutoCorrNone; } -QByteArray AirspyHFFSettings::serialize() const +QByteArray AirspyHFISettings::serialize() const { SimpleSerializer s(1); s.writeU32(1, m_devSampleRateIndex); s.writeS32(2, m_LOppmTenths); s.writeU32(3, m_log2Decim); + s.writeS32(4, (int) m_autoCorrOptions); s.writeBool(7, m_transverterMode); s.writeS64(8, m_transverterDeltaFrequency); s.writeU32(9, m_bandIndex); @@ -49,7 +50,7 @@ QByteArray AirspyHFFSettings::serialize() const return s.final(); } -bool AirspyHFFSettings::deserialize(const QByteArray& data) +bool AirspyHFISettings::deserialize(const QByteArray& data) { SimpleDeserializer d(data); @@ -68,6 +69,13 @@ bool AirspyHFFSettings::deserialize(const QByteArray& data) d.readS32(2, &m_LOppmTenths, 0); d.readU32(3, &m_log2Decim, 0); d.readS32(4, &intval, 0); + + if (intval < 0 || intval > (int) AutoCorrLast) { + m_autoCorrOptions = AutoCorrNone; + } else { + m_autoCorrOptions = (AutoCorrOptions) intval; + } + d.readBool(7, &m_transverterMode, false); d.readS64(8, &m_transverterDeltaFrequency, 0); d.readU32(9, &uintval, 0); diff --git a/plugins/samplesource/airspyhff/airspyhffsettings.h b/plugins/samplesource/airspyhfi/airspyhfisettings.h similarity index 82% rename from plugins/samplesource/airspyhff/airspyhffsettings.h rename to plugins/samplesource/airspyhfi/airspyhfisettings.h index 1a9d2a691..3f0d625d7 100644 --- a/plugins/samplesource/airspyhff/airspyhffsettings.h +++ b/plugins/samplesource/airspyhfi/airspyhfisettings.h @@ -14,11 +14,18 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#ifndef _AIRSPYHFF_AIRSPYHFFSETTINGS_H_ -#define _AIRSPYHFF_AIRSPYHFFSETTINGS_H_ +#ifndef _AIRSPYHF_AIRSPYHFISETTINGS_H_ +#define _AIRSPYHF_AIRSPYHFISETTINGS_H_ -struct AirspyHFFSettings +struct AirspyHFISettings { + typedef enum { + AutoCorrNone, + AutoCorrDC, + AutoCorrDCAndIQ, + AutoCorrLast, + } AutoCorrOptions; + quint64 m_centerFrequency; qint32 m_LOppmTenths; quint32 m_devSampleRateIndex; @@ -26,11 +33,12 @@ struct AirspyHFFSettings bool m_transverterMode; qint64 m_transverterDeltaFrequency; quint32 m_bandIndex; + AutoCorrOptions m_autoCorrOptions; - AirspyHFFSettings(); + AirspyHFISettings(); void resetToDefaults(); QByteArray serialize() const; bool deserialize(const QByteArray& data); }; -#endif /* _AIRSPYHFF_AIRSPYHFFSETTINGS_H_ */ +#endif /* _AIRSPYHF_AIRSPYHFISETTINGS_H_ */ diff --git a/plugins/samplesource/airspyhff/airspyhffthread.cpp b/plugins/samplesource/airspyhfi/airspyhfithread.cpp similarity index 77% rename from plugins/samplesource/airspyhff/airspyhffthread.cpp rename to plugins/samplesource/airspyhfi/airspyhfithread.cpp index aa8be13d8..f3953c70f 100644 --- a/plugins/samplesource/airspyhff/airspyhffthread.cpp +++ b/plugins/samplesource/airspyhfi/airspyhfithread.cpp @@ -18,15 +18,15 @@ #include #include "dsp/samplesinkfifo.h" -#include "airspyhffthread.h" +#include "airspyhfithread.h" -AirspyHFFThread *AirspyHFFThread::m_this = 0; +AirspyHFIThread *AirspyHFIThread::m_this = 0; -AirspyHFFThread::AirspyHFFThread(airspyhf_device_t* dev, SampleSinkFifo* sampleFifo, QObject* parent) : +AirspyHFIThread::AirspyHFIThread(airspyhf_device_t* dev, SampleSinkFifo* sampleFifo, QObject* parent) : QThread(parent), m_running(false), m_dev(dev), - m_convertBuffer(AIRSPYHFF_BLOCKSIZE), + m_convertBuffer(AIRSPYHFI_BLOCKSIZE), m_sampleFifo(sampleFifo), m_samplerate(10), m_log2Decim(0) @@ -34,13 +34,13 @@ AirspyHFFThread::AirspyHFFThread(airspyhf_device_t* dev, SampleSinkFifo* sampleF m_this = this; } -AirspyHFFThread::~AirspyHFFThread() +AirspyHFIThread::~AirspyHFIThread() { stopWork(); m_this = 0; } -void AirspyHFFThread::startWork() +void AirspyHFIThread::startWork() { m_startWaitMutex.lock(); start(); @@ -49,24 +49,24 @@ void AirspyHFFThread::startWork() m_startWaitMutex.unlock(); } -void AirspyHFFThread::stopWork() +void AirspyHFIThread::stopWork() { qDebug("AirspyThread::stopWork"); m_running = false; wait(); } -void AirspyHFFThread::setSamplerate(uint32_t samplerate) +void AirspyHFIThread::setSamplerate(uint32_t samplerate) { m_samplerate = samplerate; } -void AirspyHFFThread::setLog2Decimation(unsigned int log2_decim) +void AirspyHFIThread::setLog2Decimation(unsigned int log2_decim) { m_log2Decim = log2_decim; } -void AirspyHFFThread::run() +void AirspyHFIThread::run() { airspyhf_error rc; @@ -77,7 +77,7 @@ void AirspyHFFThread::run() if (rc != AIRSPYHF_SUCCESS) { - qCritical("AirspyHFFThread::run: failed to start Airspy HF Rx"); + qCritical("AirspyHFThread::run: failed to start Airspy Rx"); } else { @@ -90,16 +90,16 @@ void AirspyHFFThread::run() rc = (airspyhf_error) airspyhf_stop(m_dev); if (rc == AIRSPYHF_SUCCESS) { - qDebug("AirspyHFFThread::run: stopped Airspy HF Rx"); + qDebug("AirspyHFThread::run: stopped Airspy Rx"); } else { - qDebug("AirspyHFFThread::run: failed to stop Airspy HF Rx"); + qDebug("AirspyHFThread::run: failed to stop Airspy Rx"); } m_running = false; } // Decimate according to specified log2 (ex: log2=4 => decim=16) -void AirspyHFFThread::callback(const float* buf, qint32 len) +void AirspyHFIThread::callback(const qint16* buf, qint32 len) { SampleVector::iterator it = m_convertBuffer.begin(); @@ -134,9 +134,9 @@ void AirspyHFFThread::callback(const float* buf, qint32 len) } -int AirspyHFFThread::rx_callback(airspyhf_transfer_t* transfer) +int AirspyHFIThread::rx_callback(airspyhf_transfer_t* transfer) { - qint32 nbIAndQ = transfer->sample_count * 2; - m_this->callback((float *) transfer->samples, nbIAndQ); + qint32 bytes_to_write = transfer->sample_count * sizeof(qint16); + m_this->callback((qint16 *) transfer->samples, bytes_to_write); return 0; } diff --git a/plugins/samplesource/airspyhff/airspyhffthread.h b/plugins/samplesource/airspyhfi/airspyhfithread.h similarity index 76% rename from plugins/samplesource/airspyhff/airspyhffthread.h rename to plugins/samplesource/airspyhfi/airspyhfithread.h index f26d8c3c6..8893aa195 100644 --- a/plugins/samplesource/airspyhff/airspyhffthread.h +++ b/plugins/samplesource/airspyhfi/airspyhfithread.h @@ -14,8 +14,8 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#ifndef INCLUDE_AIRSPYHFFTHREAD_H -#define INCLUDE_AIRSPYHFFTHREAD_H +#ifndef INCLUDE_AIRSPYHFITHREAD_H +#define INCLUDE_AIRSPYHFITHREAD_H #include #include @@ -23,16 +23,16 @@ #include #include "dsp/samplesinkfifo.h" -#include "dsp/decimatorsf.h" +#include "dsp/decimators.h" -#define AIRSPYHFF_BLOCKSIZE (1<<17) +#define AIRSPYHFI_BLOCKSIZE (1<<17) -class AirspyHFFThread : public QThread { +class AirspyHFIThread : public QThread { Q_OBJECT public: - AirspyHFFThread(airspyhf_device_t* dev, SampleSinkFifo* sampleFifo, QObject* parent = 0); - ~AirspyHFFThread(); + AirspyHFIThread(airspyhf_device_t* dev, SampleSinkFifo* sampleFifo, QObject* parent = 0); + ~AirspyHFIThread(); void startWork(); void stopWork(); @@ -45,19 +45,23 @@ private: bool m_running; airspyhf_device_t* m_dev; - qint16 m_buf[2*AIRSPYHFF_BLOCKSIZE]; + qint16 m_buf[2*AIRSPYHFI_BLOCKSIZE]; SampleVector m_convertBuffer; SampleSinkFifo* m_sampleFifo; int m_samplerate; unsigned int m_log2Decim; - static AirspyHFFThread *m_this; + static AirspyHFIThread *m_this; - DecimatorsF m_decimators; +#ifdef SDR_RX_SAMPLE_24BIT + Decimators m_decimators; +#else + Decimators m_decimators; +#endif void run(); - void callback(const float* buf, qint32 len); + void callback(const qint16* buf, qint32 len); static int rx_callback(airspyhf_transfer_t* transfer); }; -#endif // INCLUDE_AIRSPYHFFTHREAD_H +#endif // INCLUDE_AIRSPYHFITHREAD_H diff --git a/plugins/samplesource/airspyhff/readme.md b/plugins/samplesource/airspyhfi/readme.md similarity index 100% rename from plugins/samplesource/airspyhff/readme.md rename to plugins/samplesource/airspyhfi/readme.md