1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-29 19:28:47 -05:00

AirspyHF support: implemented the band selector

This commit is contained in:
f4exb 2018-01-12 00:24:54 +01:00
parent 89b67b0378
commit 04a2143809
6 changed files with 48 additions and 5 deletions

View File

@ -182,8 +182,22 @@ void AirspyHFGui::updateFrequencyLimits()
{
// values in kHz
qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0;
qint64 minLimit = AirspyHFInput::loLowLimitFreqHF/1000 + deltaFrequency;
qint64 maxLimit = AirspyHFInput::loHighLimitFreqHF/1000 + deltaFrequency;
qint64 minLimit;
qint64 maxLimit;
switch(m_settings.m_bandIndex)
{
case 1:
minLimit = AirspyHFInput::loLowLimitFreqVHF/1000 + deltaFrequency;
maxLimit = AirspyHFInput::loHighLimitFreqVHF/1000 + deltaFrequency;
break;
case 0:
default:
minLimit = AirspyHFInput::loLowLimitFreqHF/1000 + deltaFrequency;
maxLimit = AirspyHFInput::loHighLimitFreqHF/1000 + deltaFrequency;
break;
}
minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit;
maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;
@ -331,6 +345,17 @@ void AirspyHFGui::on_transverter_clicked()
sendSettings();
}
void AirspyHFGui::on_band_currentIndexChanged(int index)
{
if ((index < 0) || (index > 1)) {
return;
}
m_settings.m_bandIndex = index;
updateFrequencyLimits();
sendSettings();
}
void AirspyHFGui::updateHardware()
{
qDebug() << "AirspyHFGui::updateHardware";

View File

@ -86,6 +86,7 @@ private slots:
void on_startStop_toggled(bool checked);
void on_record_toggled(bool checked);
void on_transverter_clicked();
void on_band_currentIndexChanged(int index);
void updateHardware();
void updateStatus();
void handleInputMessages();

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<width>320</width>
<height>240</height>
</rect>
</property>
@ -18,7 +18,7 @@
</property>
<property name="minimumSize">
<size>
<width>300</width>
<width>320</width>
<height>220</height>
</size>
</property>

View File

@ -134,7 +134,7 @@ bool AirspyHFInput::openDevice()
delete[] sampleRates;
airspyhf_set_sampleformat(m_dev, AIRSPYHF_SAMPLE_FORMAT_INT16);
airspyhf_set_sample_type(m_dev, AIRSPYHF_SAMPLE_INT16_NDSP_IQ);
return true;
}
@ -320,6 +320,17 @@ bool AirspyHFInput::handleMessage(const Message& message)
void AirspyHFInput::setDeviceCenterFrequency(quint64 freq_hz)
{
switch(m_settings.m_bandIndex)
{
case 1:
freq_hz = freq_hz < loLowLimitFreqVHF ? loLowLimitFreqVHF : freq_hz > loHighLimitFreqVHF ? loHighLimitFreqVHF : freq_hz;
break;
case 0:
default:
freq_hz = freq_hz < loLowLimitFreqHF ? loLowLimitFreqHF : freq_hz > loHighLimitFreqHF ? loHighLimitFreqHF : freq_hz;
break;
}
qint64 df = ((qint64)freq_hz * m_settings.m_LOppmTenths) / 10000000LL;
freq_hz += df;

View File

@ -34,6 +34,7 @@ void AirspyHFSettings::resetToDefaults()
m_iqCorrection = false;
m_transverterMode = false;
m_transverterDeltaFrequency = 0;
m_bandIndex = 0;
}
QByteArray AirspyHFSettings::serialize() const
@ -48,6 +49,7 @@ QByteArray AirspyHFSettings::serialize() const
s.writeBool(6, m_iqCorrection);
s.writeBool(7, m_transverterMode);
s.writeS64(8, m_transverterDeltaFrequency);
s.writeU32(9, m_bandIndex);
return s.final();
}
@ -65,6 +67,7 @@ bool AirspyHFSettings::deserialize(const QByteArray& data)
if (d.getVersion() == 1)
{
int intval;
quint32 uintval;
d.readU32(1, &m_devSampleRateIndex, 0);
d.readS32(2, &m_LOppmTenths, 0);
@ -75,6 +78,8 @@ bool AirspyHFSettings::deserialize(const QByteArray& data)
d.readBool(6, &m_iqCorrection, false);
d.readBool(7, &m_transverterMode, false);
d.readS64(8, &m_transverterDeltaFrequency, 0);
d.readU32(9, &uintval, 0);
m_bandIndex = uintval > 1 ? 1 : uintval;
return true;
}

View File

@ -33,6 +33,7 @@ struct AirspyHFSettings {
bool m_iqCorrection;
bool m_transverterMode;
qint64 m_transverterDeltaFrequency;
quint32 m_bandIndex;
AirspyHFSettings();
void resetToDefaults();