mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-16 05:11:49 -05:00
LimeRFE USB support: added persistent calibration map
This commit is contained in:
parent
6f14d21b1f
commit
ab4f18684e
@ -131,6 +131,8 @@ set(sdrbase_SOURCES
|
|||||||
device/deviceuserargs.cpp
|
device/deviceuserargs.cpp
|
||||||
device/deviceutils.cpp
|
device/deviceutils.cpp
|
||||||
|
|
||||||
|
limerfe/limerfeusbcalib.cpp
|
||||||
|
|
||||||
settings/preferences.cpp
|
settings/preferences.cpp
|
||||||
settings/preset.cpp
|
settings/preset.cpp
|
||||||
settings/mainsettings.cpp
|
settings/mainsettings.cpp
|
||||||
@ -270,6 +272,8 @@ set(sdrbase_HEADERS
|
|||||||
device/deviceuserargs.h
|
device/deviceuserargs.h
|
||||||
device/deviceutils.h
|
device/deviceutils.h
|
||||||
|
|
||||||
|
limerfe/limerfeusbcalib.h
|
||||||
|
|
||||||
plugin/plugininstancegui.h
|
plugin/plugininstancegui.h
|
||||||
plugin/plugininterface.h
|
plugin/plugininterface.h
|
||||||
plugin/pluginapi.h
|
plugin/pluginapi.h
|
||||||
|
71
sdrbase/limerfe/limerfeusbcalib.cpp
Normal file
71
sdrbase/limerfe/limerfeusbcalib.cpp
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2020 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// (at your option) any later version. //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <QByteArray>
|
||||||
|
#include <QDataStream>
|
||||||
|
#include <QIODevice>
|
||||||
|
|
||||||
|
#include "util/simpleserializer.h"
|
||||||
|
|
||||||
|
#include "limerfeusbcalib.h"
|
||||||
|
|
||||||
|
QByteArray LimeRFEUSBCalib::serialize() const
|
||||||
|
{
|
||||||
|
SimpleSerializer s(1);
|
||||||
|
QByteArray data;
|
||||||
|
|
||||||
|
serializeCalibMap(data);
|
||||||
|
s.writeBlob(1, data);
|
||||||
|
|
||||||
|
return s.final();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LimeRFEUSBCalib::deserialize(const QByteArray& data)
|
||||||
|
{
|
||||||
|
SimpleDeserializer d(data);
|
||||||
|
|
||||||
|
if (!d.isValid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d.getVersion() == 1)
|
||||||
|
{
|
||||||
|
QByteArray data;
|
||||||
|
|
||||||
|
d.readBlob(1, &data);
|
||||||
|
deserializeCalibMap(data);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LimeRFEUSBCalib::serializeCalibMap(QByteArray& data) const
|
||||||
|
{
|
||||||
|
QDataStream *stream = new QDataStream(&data, QIODevice::WriteOnly);
|
||||||
|
*stream << m_calibrations;
|
||||||
|
delete stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LimeRFEUSBCalib::deserializeCalibMap(QByteArray& data)
|
||||||
|
{
|
||||||
|
QDataStream readStream(&data, QIODevice::ReadOnly);
|
||||||
|
readStream >> m_calibrations;
|
||||||
|
}
|
58
sdrbase/limerfe/limerfeusbcalib.h
Normal file
58
sdrbase/limerfe/limerfeusbcalib.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2020 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// (at your option) any later version. //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef SDRBASE_LIMERFE_LIMERFEUSBCALIB_H_
|
||||||
|
#define SDRBASE_LIMERFE_LIMERFEUSBCALIB_H_
|
||||||
|
|
||||||
|
#include <QMap>
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
|
class QByteArray;
|
||||||
|
|
||||||
|
class SDRBASE_API LimeRFEUSBCalib
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QByteArray serialize() const;
|
||||||
|
bool deserialize(const QByteArray& data);
|
||||||
|
|
||||||
|
enum ChannelRange
|
||||||
|
{
|
||||||
|
WidebandLow, //!< 1 - 1000 MHz
|
||||||
|
WidebandHigh, //!< 1000 - 4000 MHz
|
||||||
|
HAM_30MHz, //!< Up to 30 MHz
|
||||||
|
HAM_50_70MHz,
|
||||||
|
HAM_144_146MHz,
|
||||||
|
HAM_220_225MHz,
|
||||||
|
HAM_430_440MHz,
|
||||||
|
HAM_902_928MHz,
|
||||||
|
HAM_1240_1325MHz,
|
||||||
|
HAM_2300_2450MHz,
|
||||||
|
HAM_3300_3500MHz,
|
||||||
|
CellularBand1,
|
||||||
|
CellularBand2,
|
||||||
|
CellularBand7,
|
||||||
|
CellularBand38
|
||||||
|
};
|
||||||
|
|
||||||
|
QMap<int, int> m_calibrations; //!< Channel range to calibration value in centi-Bels
|
||||||
|
|
||||||
|
private:
|
||||||
|
void serializeCalibMap(QByteArray& data) const;
|
||||||
|
void deserializeCalibMap(QByteArray& data);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SDRBASE_LIMERFE_LIMERFEUSBCALIB_H_
|
@ -93,6 +93,7 @@ void MainSettings::load()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_hardwareDeviceUserArgs.deserialize(qUncompress(QByteArray::fromBase64(s.value("hwDeviceUserArgs").toByteArray())));
|
m_hardwareDeviceUserArgs.deserialize(qUncompress(QByteArray::fromBase64(s.value("hwDeviceUserArgs").toByteArray())));
|
||||||
|
m_limeRFEUSBCalib.deserialize(qUncompress(QByteArray::fromBase64(s.value("limeRFEUSBCalib").toByteArray())));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainSettings::save() const
|
void MainSettings::save() const
|
||||||
@ -137,6 +138,7 @@ void MainSettings::save() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
s.setValue("hwDeviceUserArgs", qCompress(m_hardwareDeviceUserArgs.serialize()).toBase64());
|
s.setValue("hwDeviceUserArgs", qCompress(m_hardwareDeviceUserArgs.serialize()).toBase64());
|
||||||
|
s.setValue("limeRFEUSBCalib", qCompress(m_limeRFEUSBCalib.serialize()).toBase64());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainSettings::initialize()
|
void MainSettings::initialize()
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include "device/deviceuserargs.h"
|
#include "device/deviceuserargs.h"
|
||||||
|
#include "limerfe/limerfeusbcalib.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
#include "preset.h"
|
#include "preset.h"
|
||||||
#include "export.h"
|
#include "export.h"
|
||||||
@ -69,6 +70,7 @@ public:
|
|||||||
bool getUseLogFile() const { return m_preferences.getUseLogFile(); }
|
bool getUseLogFile() const { return m_preferences.getUseLogFile(); }
|
||||||
const QString& getLogFileName() const { return m_preferences.getLogFileName(); }
|
const QString& getLogFileName() const { return m_preferences.getLogFileName(); }
|
||||||
DeviceUserArgs& getDeviceUserArgs() { return m_hardwareDeviceUserArgs; }
|
DeviceUserArgs& getDeviceUserArgs() { return m_hardwareDeviceUserArgs; }
|
||||||
|
LimeRFEUSBCalib& getLimeRFEUSBCalib() { return m_limeRFEUSBCalib; }
|
||||||
|
|
||||||
const AudioDeviceManager *getAudioDeviceManager() const { return m_audioDeviceManager; }
|
const AudioDeviceManager *getAudioDeviceManager() const { return m_audioDeviceManager; }
|
||||||
void setAudioDeviceManager(AudioDeviceManager *audioDeviceManager) { m_audioDeviceManager = audioDeviceManager; }
|
void setAudioDeviceManager(AudioDeviceManager *audioDeviceManager) { m_audioDeviceManager = audioDeviceManager; }
|
||||||
@ -83,6 +85,7 @@ protected:
|
|||||||
typedef QList<Command*> Commands;
|
typedef QList<Command*> Commands;
|
||||||
Commands m_commands;
|
Commands m_commands;
|
||||||
DeviceUserArgs m_hardwareDeviceUserArgs;
|
DeviceUserArgs m_hardwareDeviceUserArgs;
|
||||||
|
LimeRFEUSBCalib m_limeRFEUSBCalib;
|
||||||
AMBEEngine *m_ambeEngine;
|
AMBEEngine *m_ambeEngine;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user