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:
parent
89b67b0378
commit
04a2143809
@ -182,8 +182,22 @@ void AirspyHFGui::updateFrequencyLimits()
|
|||||||
{
|
{
|
||||||
// values in kHz
|
// values in kHz
|
||||||
qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0;
|
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;
|
minLimit = minLimit < 0 ? 0 : minLimit > 9999999 ? 9999999 : minLimit;
|
||||||
maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;
|
maxLimit = maxLimit < 0 ? 0 : maxLimit > 9999999 ? 9999999 : maxLimit;
|
||||||
@ -331,6 +345,17 @@ void AirspyHFGui::on_transverter_clicked()
|
|||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AirspyHFGui::on_band_currentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
if ((index < 0) || (index > 1)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_settings.m_bandIndex = index;
|
||||||
|
updateFrequencyLimits();
|
||||||
|
sendSettings();
|
||||||
|
}
|
||||||
|
|
||||||
void AirspyHFGui::updateHardware()
|
void AirspyHFGui::updateHardware()
|
||||||
{
|
{
|
||||||
qDebug() << "AirspyHFGui::updateHardware";
|
qDebug() << "AirspyHFGui::updateHardware";
|
||||||
|
@ -86,6 +86,7 @@ private slots:
|
|||||||
void on_startStop_toggled(bool checked);
|
void on_startStop_toggled(bool checked);
|
||||||
void on_record_toggled(bool checked);
|
void on_record_toggled(bool checked);
|
||||||
void on_transverter_clicked();
|
void on_transverter_clicked();
|
||||||
|
void on_band_currentIndexChanged(int index);
|
||||||
void updateHardware();
|
void updateHardware();
|
||||||
void updateStatus();
|
void updateStatus();
|
||||||
void handleInputMessages();
|
void handleInputMessages();
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>300</width>
|
<width>320</width>
|
||||||
<height>240</height>
|
<height>240</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -18,7 +18,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>300</width>
|
<width>320</width>
|
||||||
<height>220</height>
|
<height>220</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -134,7 +134,7 @@ bool AirspyHFInput::openDevice()
|
|||||||
|
|
||||||
delete[] sampleRates;
|
delete[] sampleRates;
|
||||||
|
|
||||||
airspyhf_set_sampleformat(m_dev, AIRSPYHF_SAMPLE_FORMAT_INT16);
|
airspyhf_set_sample_type(m_dev, AIRSPYHF_SAMPLE_INT16_NDSP_IQ);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -320,6 +320,17 @@ bool AirspyHFInput::handleMessage(const Message& message)
|
|||||||
|
|
||||||
void AirspyHFInput::setDeviceCenterFrequency(quint64 freq_hz)
|
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;
|
qint64 df = ((qint64)freq_hz * m_settings.m_LOppmTenths) / 10000000LL;
|
||||||
freq_hz += df;
|
freq_hz += df;
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ void AirspyHFSettings::resetToDefaults()
|
|||||||
m_iqCorrection = false;
|
m_iqCorrection = false;
|
||||||
m_transverterMode = false;
|
m_transverterMode = false;
|
||||||
m_transverterDeltaFrequency = 0;
|
m_transverterDeltaFrequency = 0;
|
||||||
|
m_bandIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray AirspyHFSettings::serialize() const
|
QByteArray AirspyHFSettings::serialize() const
|
||||||
@ -48,6 +49,7 @@ QByteArray AirspyHFSettings::serialize() const
|
|||||||
s.writeBool(6, m_iqCorrection);
|
s.writeBool(6, m_iqCorrection);
|
||||||
s.writeBool(7, m_transverterMode);
|
s.writeBool(7, m_transverterMode);
|
||||||
s.writeS64(8, m_transverterDeltaFrequency);
|
s.writeS64(8, m_transverterDeltaFrequency);
|
||||||
|
s.writeU32(9, m_bandIndex);
|
||||||
|
|
||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
@ -65,6 +67,7 @@ bool AirspyHFSettings::deserialize(const QByteArray& data)
|
|||||||
if (d.getVersion() == 1)
|
if (d.getVersion() == 1)
|
||||||
{
|
{
|
||||||
int intval;
|
int intval;
|
||||||
|
quint32 uintval;
|
||||||
|
|
||||||
d.readU32(1, &m_devSampleRateIndex, 0);
|
d.readU32(1, &m_devSampleRateIndex, 0);
|
||||||
d.readS32(2, &m_LOppmTenths, 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(6, &m_iqCorrection, false);
|
||||||
d.readBool(7, &m_transverterMode, false);
|
d.readBool(7, &m_transverterMode, false);
|
||||||
d.readS64(8, &m_transverterDeltaFrequency, 0);
|
d.readS64(8, &m_transverterDeltaFrequency, 0);
|
||||||
|
d.readU32(9, &uintval, 0);
|
||||||
|
m_bandIndex = uintval > 1 ? 1 : uintval;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ struct AirspyHFSettings {
|
|||||||
bool m_iqCorrection;
|
bool m_iqCorrection;
|
||||||
bool m_transverterMode;
|
bool m_transverterMode;
|
||||||
qint64 m_transverterDeltaFrequency;
|
qint64 m_transverterDeltaFrequency;
|
||||||
|
quint32 m_bandIndex;
|
||||||
|
|
||||||
AirspyHFSettings();
|
AirspyHFSettings();
|
||||||
void resetToDefaults();
|
void resetToDefaults();
|
||||||
|
Loading…
Reference in New Issue
Block a user