From 41901fed2505217e725a10b6169f6a5e05ecd399 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 22 May 2022 23:13:04 +0200 Subject: [PATCH] LimeRFE feature: move calibration to settings --- plugins/feature/limerfe/limerfe.cpp | 17 ++--------------- plugins/feature/limerfe/limerfe.h | 4 ---- plugins/feature/limerfe/limerfegui.cpp | 7 +++---- plugins/feature/limerfe/limerfegui.h | 2 -- plugins/feature/limerfe/limerfesettings.cpp | 3 +++ plugins/feature/limerfe/limerfesettings.h | 3 +++ 6 files changed, 11 insertions(+), 25 deletions(-) diff --git a/plugins/feature/limerfe/limerfe.cpp b/plugins/feature/limerfe/limerfe.cpp index a8d21dc7e..bf49c64bd 100644 --- a/plugins/feature/limerfe/limerfe.cpp +++ b/plugins/feature/limerfe/limerfe.cpp @@ -128,10 +128,7 @@ bool LimeRFE::handleMessage(const Message& cmd) QByteArray LimeRFE::serialize() const { SimpleSerializer s(1); - s.writeBlob(1, m_settings.serialize()); - s.writeBlob(2, m_calib.serialize()); - return s.final(); } @@ -148,31 +145,21 @@ bool LimeRFE::deserialize(const QByteArray& data) if (d.getVersion() == 1) { QByteArray bytetmp; - bool ret; - d.readBlob(1, &bytetmp); if (m_settings.deserialize(bytetmp)) { MsgConfigureLimeRFE *msg = MsgConfigureLimeRFE::create(m_settings, true); m_inputMessageQueue.push(msg); - ret = true; + return true; } else { m_settings.resetToDefaults(); MsgConfigureLimeRFE *msg = MsgConfigureLimeRFE::create(m_settings, true); m_inputMessageQueue.push(msg); - ret = false; + return false; } - - d.readBlob(2, &bytetmp); - - if (!m_calib.deserialize(bytetmp)) { - ret = false; - } - - return ret; } else { diff --git a/plugins/feature/limerfe/limerfe.h b/plugins/feature/limerfe/limerfe.h index 9f24490bc..4f8e168e6 100644 --- a/plugins/feature/limerfe/limerfe.h +++ b/plugins/feature/limerfe/limerfe.h @@ -28,7 +28,6 @@ #include "util/message.h" #include "limerfesettings.h" -#include "limerfeusbcalib.h" class QNetworkReply; class QNetworkAccessManager; @@ -137,8 +136,6 @@ public: const QStringList& featureSettingsKeys, SWGSDRangel::SWGFeatureSettings& response); - LimeRFEUSBCalib *getCalib() { return &m_calib; } - int openDevice(const std::string& serialDeviceName); void closeDevice(); @@ -162,7 +159,6 @@ public: private: LimeRFESettings m_settings; - LimeRFEUSBCalib m_calib; bool m_rxOn; bool m_txOn; diff --git a/plugins/feature/limerfe/limerfegui.cpp b/plugins/feature/limerfe/limerfegui.cpp index 32c136820..ef3454a05 100644 --- a/plugins/feature/limerfe/limerfegui.cpp +++ b/plugins/feature/limerfe/limerfegui.cpp @@ -147,7 +147,6 @@ LimeRFEGUI::LimeRFEGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature m_limeRFE = reinterpret_cast(feature); m_limeRFE->setMessageQueueToGUI(&m_inputMessageQueue); - m_limeRFEUSBCalib = m_limeRFE->getCalib(); for (const auto& comPortName : m_limeRFE->getComPorts()) { ui->device->addItem(comPortName); @@ -556,9 +555,9 @@ double LimeRFEGUI::getPowerCorrection() { int index = getPowerCorectionIndex(); - QMap::const_iterator it = m_limeRFEUSBCalib->m_calibrations.find(index); + QMap::const_iterator it = m_settings.m_calib.m_calibrations.find(index); - if (it != m_limeRFEUSBCalib->m_calibrations.end()) { + if (it != m_settings.m_calib.m_calibrations.end()) { return it.value(); } else { return 0.0; @@ -573,7 +572,7 @@ void LimeRFEGUI::setPowerCorrection(double dbValue) return; } - m_limeRFEUSBCalib->m_calibrations[index] = dbValue; + m_settings.m_calib.m_calibrations[index] = dbValue; } void LimeRFEGUI::updateAbsPower(double powerCorrDB) diff --git a/plugins/feature/limerfe/limerfegui.h b/plugins/feature/limerfe/limerfegui.h index f3563b8ea..17448886f 100644 --- a/plugins/feature/limerfe/limerfegui.h +++ b/plugins/feature/limerfe/limerfegui.h @@ -31,7 +31,6 @@ class PluginAPI; class FeatureUISet; class Feature; class LimeRFE; -class LimeRFEUSBCalib; class DSPDeviceSourceEngine; class DSPDeviceSinkEngine; @@ -63,7 +62,6 @@ private: PluginAPI* m_pluginAPI; FeatureUISet* m_featureUISet; LimeRFESettings m_settings; - LimeRFEUSBCalib* m_limeRFEUSBCalib; RollupState m_rollupState; bool m_rxOn; bool m_txOn; diff --git a/plugins/feature/limerfe/limerfesettings.cpp b/plugins/feature/limerfe/limerfesettings.cpp index 12a87b6fa..98d94ffb0 100644 --- a/plugins/feature/limerfe/limerfesettings.cpp +++ b/plugins/feature/limerfe/limerfesettings.cpp @@ -93,6 +93,7 @@ QByteArray LimeRFESettings::serialize() const s.writeS32(38, m_workspaceIndex); s.writeBlob(39, m_geometryBytes); s.writeString(40, m_devicePath); + s.writeBlob(41, m_calib.serialize()); return s.final(); } @@ -168,6 +169,8 @@ bool LimeRFESettings::deserialize(const QByteArray& data) d.readS32(38, &m_workspaceIndex, 0); d.readBlob(39, &m_geometryBytes); d.readString(40, &m_devicePath, ""); + d.readBlob(41, &bytetmp); + m_calib.deserialize(bytetmp); return true; } diff --git a/plugins/feature/limerfe/limerfesettings.h b/plugins/feature/limerfe/limerfesettings.h index 2e29381b5..8dca60c6b 100644 --- a/plugins/feature/limerfe/limerfesettings.h +++ b/plugins/feature/limerfe/limerfesettings.h @@ -21,6 +21,8 @@ #include #include +#include "limerfeusbcalib.h" + class Serializable; struct LimeRFESettings @@ -109,6 +111,7 @@ struct LimeRFESettings Serializable *m_rollupState; int m_workspaceIndex; QByteArray m_geometryBytes; + LimeRFEUSBCalib m_calib; LimeRFESettings(); void resetToDefaults();