1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00

WFM demod: use same RF filter values as the modulator

This commit is contained in:
f4exb 2017-01-05 11:54:15 +01:00
parent 4b89ac3360
commit 3960df4c2a
3 changed files with 43 additions and 63 deletions

View File

@ -20,8 +20,9 @@
const QString WFMDemodGUI::m_channelID = "de.maintech.sdrangelove.channel.wfm";
const int WFMDemodGUI::m_rfBW[] = {
48000, 80000, 100000, 120000, 140000, 160000, 180000, 200000, 220000, 250000
12500, 25000, 40000, 60000, 75000, 80000, 100000, 125000, 140000, 160000, 180000, 200000, 220000, 250000
};
const int WFMDemodGUI::m_nbRfBW = 14;
int requiredBW(int rfBW)
{
@ -69,7 +70,7 @@ void WFMDemodGUI::resetToDefaults()
{
blockApplySettings(true);
ui->rfBW->setValue(4);
ui->rfBW->setCurrentIndex(6);
ui->afBW->setValue(3);
ui->volume->setValue(20);
ui->squelch->setValue(-40);
@ -83,7 +84,7 @@ QByteArray WFMDemodGUI::serialize() const
{
SimpleSerializer s(1);
s.writeS32(1, m_channelMarker.getCenterFrequency());
s.writeS32(2, ui->rfBW->value());
s.writeS32(2, ui->rfBW->currentIndex());
s.writeS32(3, ui->afBW->value());
s.writeS32(4, ui->volume->value());
s.writeS32(5, ui->squelch->value());
@ -113,9 +114,8 @@ bool WFMDemodGUI::deserialize(const QByteArray& data)
d.readS32(1, &tmp, 0);
m_channelMarker.setCenterFrequency(tmp);
d.readS32(2, &tmp, 4);
ui->rfBW->setValue(tmp);
ui->rfBWText->setText(QString("%1 kHz").arg(m_rfBW[tmp] / 1000.0));
d.readS32(2, &tmp, 6);
ui->rfBW->setCurrentIndex(tmp);
m_channelMarker.setBandwidth(m_rfBW[tmp]);
d.readS32(3, &tmp, 3);
@ -178,10 +178,9 @@ void WFMDemodGUI::on_deltaFrequency_changed(quint64 value)
}
}
void WFMDemodGUI::on_rfBW_valueChanged(int value)
void WFMDemodGUI::on_rfBW_currentIndexChanged(int index)
{
ui->rfBWText->setText(QString("%1 kHz").arg(m_rfBW[value] / 1000.0));
m_channelMarker.setBandwidth(m_rfBW[value]);
m_channelMarker.setBandwidth(m_rfBW[index]);
applySettings();
}
@ -232,6 +231,15 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidg
ui->deltaFrequency->setValueRange(7, 0U, 9999999U);
setAttribute(Qt::WA_DeleteOnClose, true);
blockApplySettings(true);
ui->rfBW->clear();
for (int i = 0; i < m_nbRfBW; i++) {
ui->rfBW->addItem(QString("%1").arg(m_rfBW[i] / 1000.0, 0, 'f', 2));
}
ui->rfBW->setCurrentIndex(6);
blockApplySettings(false);
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked()));
@ -280,14 +288,14 @@ void WFMDemodGUI::applySettings()
setTitleColor(m_channelMarker.getColor());
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
requiredBW(m_rfBW[ui->rfBW->value()]), // TODO: this is where requested sample rate is specified
requiredBW(m_rfBW[ui->rfBW->currentIndex()]), // TODO: this is where requested sample rate is specified
m_channelMarker.getCenterFrequency());
ui->deltaFrequency->setValue(abs(m_channelMarker.getCenterFrequency()));
ui->deltaMinus->setChecked(m_channelMarker.getCenterFrequency() < 0);
m_wfmDemod->configure(m_wfmDemod->getInputMessageQueue(),
m_rfBW[ui->rfBW->value()],
m_rfBW[ui->rfBW->currentIndex()],
ui->afBW->value() * 1000.0,
ui->volume->value() / 10.0,
ui->squelch->value());

View File

@ -41,7 +41,7 @@ private slots:
void viewChanged();
void on_deltaFrequency_changed(quint64 value);
void on_deltaMinus_toggled(bool minus);
void on_rfBW_valueChanged(int value);
void on_rfBW_currentIndexChanged(int index);
void on_afBW_valueChanged(int value);
void on_volume_valueChanged(int value);
void on_squelch_valueChanged(int value);
@ -63,6 +63,7 @@ private:
MovingAverage<Real> m_channelPowerDbAvg;
static const int m_rfBW[];
static const int m_nbRfBW;
explicit WFMDemodGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~WFMDemodGUI();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>263</width>
<height>143</height>
<width>288</width>
<height>147</height>
</rect>
</property>
<property name="font">
@ -24,7 +24,7 @@
<rect>
<x>10</x>
<y>10</y>
<width>235</width>
<width>261</width>
<height>121</height>
</rect>
</property>
@ -140,58 +140,29 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="rfBandwidthLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>RF BW</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="rfBW">
<property name="toolTip">
<string>Demodulator (RF) bandwidth</string>
</property>
<property name="maximum">
<number>9</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>4</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="rfBWText">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>140kHz</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="afBandwidthLayout">
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="rfBWLabel">
<property name="text">
<string>AF BW</string>
<string>RFBW</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="rfBW">
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="afBWLabel">
<property name="text">
<string>AFBW</string>
</property>
</widget>
</item>