mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
Airspy input: implemented transverter feature
This commit is contained in:
parent
97fa96979a
commit
84d5b4f1ee
@ -42,7 +42,7 @@ AirspyGui::AirspyGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
ui->centerFrequency->setValueRange(7, 24000U, 1900000U);
|
||||
updateFrequencyLimits();
|
||||
|
||||
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
|
||||
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
||||
@ -114,17 +114,6 @@ bool AirspyGui::deserialize(const QByteArray& data)
|
||||
bool AirspyGui::handleMessage(const Message& message __attribute__((unused)))
|
||||
{
|
||||
return false;
|
||||
// if (AirspyInput::MsgReportAirspy::match(message))
|
||||
// {
|
||||
// qDebug() << "AirspyGui::handleMessage: MsgReportAirspy";
|
||||
// m_rates = ((AirspyInput::MsgReportAirspy&) message).getSampleRates();
|
||||
// displaySampleRates();
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
void AirspyGui::handleInputMessages()
|
||||
@ -162,8 +151,26 @@ void AirspyGui::updateSampleRateAndFrequency()
|
||||
ui->deviceRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000));
|
||||
}
|
||||
|
||||
void AirspyGui::updateFrequencyLimits()
|
||||
{
|
||||
// values in kHz
|
||||
qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0;
|
||||
qint64 minLimit = AirspyInput::loLowLimitFreq/1000 + deltaFrequency;
|
||||
qint64 maxLimit = AirspyInput::loHighLimitFreq/1000 + deltaFrequency;
|
||||
|
||||
minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit;
|
||||
maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;
|
||||
|
||||
qDebug("AirspyGui::updateFrequencyLimits: delta: %lld min: %lld max: %lld", deltaFrequency, minLimit, maxLimit);
|
||||
|
||||
ui->centerFrequency->setValueRange(7, minLimit, maxLimit);
|
||||
}
|
||||
|
||||
void AirspyGui::displaySettings()
|
||||
{
|
||||
ui->transverter->setDeltaFrequency(m_settings.m_transverterDeltaFrequency);
|
||||
ui->transverter->setDeltaFrequencyActive(m_settings.m_transverterMode);
|
||||
updateFrequencyLimits();
|
||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||
|
||||
ui->LOppm->setValue(m_settings.m_LOppmTenths);
|
||||
@ -355,6 +362,16 @@ void AirspyGui::on_record_toggled(bool checked)
|
||||
m_sampleSource->getInputMessageQueue()->push(message);
|
||||
}
|
||||
|
||||
void AirspyGui::on_transverter_clicked()
|
||||
{
|
||||
m_settings.m_transverterMode = ui->transverter->getDeltaFrequencyAcive();
|
||||
m_settings.m_transverterDeltaFrequency = ui->transverter->getDeltaFrequency();
|
||||
qDebug("AirspyGui::on_transverter_clicked: %lld Hz %s", m_settings.m_transverterDeltaFrequency, m_settings.m_transverterMode ? "on" : "off");
|
||||
updateFrequencyLimits();
|
||||
m_settings.m_centerFrequency = ui->centerFrequency->getValueNew()*1000;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyGui::updateHardware()
|
||||
{
|
||||
qDebug() << "AirspyGui::updateHardware";
|
||||
|
@ -72,6 +72,7 @@ private:
|
||||
void displaySampleRates();
|
||||
void sendSettings();
|
||||
void updateSampleRateAndFrequency();
|
||||
void updateFrequencyLimits();
|
||||
|
||||
private slots:
|
||||
void on_centerFrequency_changed(quint64 value);
|
||||
@ -89,6 +90,7 @@ private slots:
|
||||
void on_mixAGC_stateChanged(int state);
|
||||
void on_startStop_toggled(bool checked);
|
||||
void on_record_toggled(bool checked);
|
||||
void on_transverter_clicked();
|
||||
void updateHardware();
|
||||
void updateStatus();
|
||||
void handleInputMessages();
|
||||
|
@ -267,6 +267,22 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="TransverterButton" name="transverter">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Transverter frequency translation dialog</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -645,6 +661,11 @@
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TransverterButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>gui/transverterbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../sdrbase/resources/res.qrc"/>
|
||||
|
@ -30,7 +30,9 @@
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(AirspyInput::MsgConfigureAirspy, Message)
|
||||
MESSAGE_CLASS_DEFINITION(AirspyInput::MsgFileRecord, Message)
|
||||
//MESSAGE_CLASS_DEFINITION(AirspyInput::MsgReportAirspy, Message)
|
||||
|
||||
const qint64 AirspyInput::loLowLimitFreq = 24000000L;
|
||||
const qint64 AirspyInput::loHighLimitFreq = 1900000000L;
|
||||
|
||||
AirspyInput::AirspyInput(DeviceSourceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
@ -332,15 +334,22 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
qint64 deviceCenterFrequency = m_settings.m_centerFrequency;
|
||||
qint64 f_img = deviceCenterFrequency;
|
||||
quint32 devSampleRate = m_sampleRates[m_settings.m_devSampleRateIndex];
|
||||
|
||||
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency) ||
|
||||
(m_settings.m_LOppmTenths != settings.m_LOppmTenths) ||
|
||||
(m_settings.m_fcPos != settings.m_fcPos))
|
||||
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|
||||
|| (m_settings.m_LOppmTenths != settings.m_LOppmTenths)
|
||||
|| (m_settings.m_fcPos != settings.m_fcPos)
|
||||
|| (m_settings.m_transverterMode != settings.m_transverterMode)
|
||||
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency))
|
||||
{
|
||||
m_settings.m_centerFrequency = settings.m_centerFrequency;
|
||||
m_settings.m_centerFrequency = settings.m_centerFrequency;
|
||||
m_settings.m_transverterMode = settings.m_transverterMode;
|
||||
m_settings.m_transverterDeltaFrequency = settings.m_transverterDeltaFrequency;
|
||||
|
||||
qint64 deviceCenterFrequency = m_settings.m_centerFrequency;
|
||||
deviceCenterFrequency -= m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency : 0;
|
||||
deviceCenterFrequency = deviceCenterFrequency < 0 ? 0 : deviceCenterFrequency;
|
||||
qint64 f_img = deviceCenterFrequency;
|
||||
quint32 devSampleRate = m_sampleRates[m_settings.m_devSampleRateIndex];
|
||||
|
||||
m_settings.m_LOppmTenths = settings.m_LOppmTenths;
|
||||
|
||||
if ((m_settings.m_log2Decim == 0) || (settings.m_fcPos == AirspySettings::FC_POS_CENTER))
|
||||
@ -503,7 +512,7 @@ bool AirspyInput::applySettings(const AirspySettings& settings, bool force)
|
||||
|
||||
if (forwardChange)
|
||||
{
|
||||
int sampleRate = devSampleRate/(1<<m_settings.m_log2Decim);
|
||||
int sampleRate = m_sampleRates[m_settings.m_devSampleRateIndex]/(1<<m_settings.m_log2Decim);
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency);
|
||||
m_fileSink->handleMessage(*notif); // forward to file sink
|
||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||
|
@ -68,26 +68,6 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
// class MsgReportAirspy : public Message {
|
||||
// MESSAGE_CLASS_DECLARATION
|
||||
//
|
||||
// public:
|
||||
// const std::vector<uint32_t>& getSampleRates() const { return m_sampleRates; }
|
||||
//
|
||||
// static MsgReportAirspy* create(const std::vector<uint32_t>& sampleRates)
|
||||
// {
|
||||
// return new MsgReportAirspy(sampleRates);
|
||||
// }
|
||||
//
|
||||
// protected:
|
||||
// std::vector<uint32_t> m_sampleRates;
|
||||
//
|
||||
// MsgReportAirspy(const std::vector<uint32_t>& sampleRates) :
|
||||
// Message(),
|
||||
// m_sampleRates(sampleRates)
|
||||
// { }
|
||||
// };
|
||||
|
||||
AirspyInput(DeviceSourceAPI *deviceAPI);
|
||||
virtual ~AirspyInput();
|
||||
virtual void destroy();
|
||||
@ -102,6 +82,9 @@ public:
|
||||
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
||||
static const qint64 loLowLimitFreq;
|
||||
static const qint64 loHighLimitFreq;
|
||||
|
||||
private:
|
||||
bool openDevice();
|
||||
void closeDevice();
|
||||
|
@ -38,6 +38,8 @@ void AirspySettings::resetToDefaults()
|
||||
m_biasT = false;
|
||||
m_dcBlock = false;
|
||||
m_iqCorrection = false;
|
||||
m_transverterMode = false;
|
||||
m_transverterDeltaFrequency = 0;
|
||||
}
|
||||
|
||||
QByteArray AirspySettings::serialize() const
|
||||
@ -56,6 +58,8 @@ QByteArray AirspySettings::serialize() const
|
||||
s.writeBool(10, m_iqCorrection);
|
||||
s.writeBool(11, m_lnaAGC);
|
||||
s.writeBool(12, m_mixerAGC);
|
||||
s.writeBool(13, m_transverterMode);
|
||||
s.writeS64(14, m_transverterDeltaFrequency);
|
||||
|
||||
return s.final();
|
||||
}
|
||||
@ -87,6 +91,8 @@ bool AirspySettings::deserialize(const QByteArray& data)
|
||||
d.readBool(10, &m_iqCorrection, false);
|
||||
d.readBool(11, &m_lnaAGC, false);
|
||||
d.readBool(12, &m_mixerAGC, false);
|
||||
d.readBool(13, &m_transverterMode, false);
|
||||
d.readS64(14, &m_transverterDeltaFrequency, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ struct AirspySettings {
|
||||
bool m_biasT;
|
||||
bool m_dcBlock;
|
||||
bool m_iqCorrection;
|
||||
bool m_transverterMode;
|
||||
qint64 m_transverterDeltaFrequency;
|
||||
|
||||
AirspySettings();
|
||||
void resetToDefaults();
|
||||
|
@ -372,9 +372,8 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
m_settings.m_transverterMode = settings.m_transverterMode;
|
||||
m_settings.m_transverterDeltaFrequency = settings.m_transverterDeltaFrequency;
|
||||
qint64 deviceCenterFrequency = m_settings.m_centerFrequency;
|
||||
|
||||
deviceCenterFrequency -= m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency : 0;
|
||||
|
||||
deviceCenterFrequency = deviceCenterFrequency < 0 ? 0 : deviceCenterFrequency;
|
||||
qint64 f_img = deviceCenterFrequency;
|
||||
quint32 devSampleRate = m_settings.m_devSampleRate;
|
||||
|
||||
@ -398,8 +397,6 @@ bool RTLSDRInput::applySettings(const RTLSDRSettings& settings, bool force)
|
||||
}
|
||||
}
|
||||
|
||||
deviceCenterFrequency = deviceCenterFrequency < 0 ? 0 : deviceCenterFrequency;
|
||||
|
||||
if (m_dev != 0)
|
||||
{
|
||||
if (rtlsdr_set_center_freq( m_dev, deviceCenterFrequency ) != 0)
|
||||
|
Loading…
Reference in New Issue
Block a user