mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 16:08:39 -05:00
LimeRFE feature: move calibration to settings
This commit is contained in:
parent
d0c2b24694
commit
41901fed25
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
|
||||
|
@ -147,7 +147,6 @@ LimeRFEGUI::LimeRFEGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature
|
||||
|
||||
m_limeRFE = reinterpret_cast<LimeRFE*>(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<int, double>::const_iterator it = m_limeRFEUSBCalib->m_calibrations.find(index);
|
||||
QMap<int, double>::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)
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
|
||||
#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();
|
||||
|
Loading…
Reference in New Issue
Block a user