1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 01:18:38 -05:00

WFM demod: variable RF bandwidth. Implements #320

This commit is contained in:
f4exb 2019-06-04 20:48:06 +02:00
parent e061a45e62
commit 8a66650df4
7 changed files with 83 additions and 64 deletions

View File

@ -1,3 +1,10 @@
sdrangel (4.9.1-1) unstable; urgency=medium
* WFM demod: variable RF bandwidth. Implements #320
* Fixed buddies list handling at buddy termination time. Fixes #359
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sat, 08 Jun 2019 20:44:06 +0100
sdrangel (4.9.0-1) unstable; urgency=medium
* New build system

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
sdrangel (4.9.1-1) unstable; urgency=medium
* WFM demod: variable RF bandwidth. Implements #320
* Fixed buddies list handling at buddy termination time. Fixes #359
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sat, 08 Jun 2019 20:44:06 +0100
sdrangel (4.9.0-1) unstable; urgency=medium
* New build system

View File

@ -126,10 +126,10 @@ void WFMDemodGUI::on_deltaFrequency_changed(qint64 value)
applySettings();
}
void WFMDemodGUI::on_rfBW_currentIndexChanged(int index)
void WFMDemodGUI::on_rfBW_changed(quint64 value)
{
m_channelMarker.setBandwidth(WFMDemodSettings::getRFBW(index));
m_settings.m_rfBandwidth = WFMDemodSettings::getRFBW(index);
m_channelMarker.setBandwidth(value);
m_settings.m_rfBandwidth = value;
applySettings();
}
@ -225,16 +225,11 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
ui->deltaFrequency->setValueRange(false, 7, -9999999, 9999999);
ui->channelPowerMeter->setColorTheme(LevelMeterSignalDB::ColorGreenAndBlue);
blockApplySettings(true);
ui->rfBW->clear();
for (int i = 0; i < WFMDemodSettings::m_nbRFBW; i++) {
ui->rfBW->addItem(QString("%1").arg(WFMDemodSettings::getRFBW(i) / 1000.0, 0, 'f', 2));
}
ui->rfBW->setCurrentIndex(6);
blockApplySettings(false);
ui->rfBW->setColorMapper(ColorMapper(ColorMapper::GrayYellow));
ui->rfBW->setValueRange(WFMDemodSettings::m_rfBWDigits, WFMDemodSettings::m_rfBWMin, WFMDemodSettings::m_rfBWMax);
m_channelMarker.blockSignals(true);
m_channelMarker.setBandwidth(WFMDemodSettings::getRFBW(4));
m_channelMarker.setBandwidth(m_settings.m_rfBandwidth);
m_channelMarker.setCenterFrequency(0);
m_channelMarker.setTitle("WFM Demodulator");
m_channelMarker.setColor(m_settings.m_rgbColor);
@ -273,7 +268,7 @@ void WFMDemodGUI::applySettings(bool force)
if (m_doApplySettings)
{
WFMDemod::MsgConfigureChannelizer *msgChan = WFMDemod::MsgConfigureChannelizer::create(
WFMDemod::requiredBW(WFMDemodSettings::getRFBW(ui->rfBW->currentIndex())),
m_settings.m_rfBandwidth,
m_channelMarker.getCenterFrequency());
m_wfmDemod->getInputMessageQueue()->push(msgChan);
@ -297,18 +292,13 @@ void WFMDemodGUI::displaySettings()
blockApplySettings(true);
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
ui->rfBW->setCurrentIndex(WFMDemodSettings::getRFBWIndex(m_settings.m_rfBandwidth));
ui->rfBW->setValue(m_settings.m_rfBandwidth);
ui->afBW->setValue(m_settings.m_afBandwidth/1000.0);
ui->afBWText->setText(QString("%1 kHz").arg(m_settings.m_afBandwidth/1000.0));
ui->volume->setValue(m_settings.m_volume * 10.0);
ui->volumeText->setText(QString("%1").arg(m_settings.m_volume, 0, 'f', 1));
ui->squelch->setValue(m_settings.m_squelch);
ui->squelchText->setText(QString("%1 dB").arg(m_settings.m_squelch));
ui->audioMute->setChecked(m_settings.m_audioMute);
blockApplySettings(false);

View File

@ -65,7 +65,7 @@ private:
private slots:
void on_deltaFrequency_changed(qint64 value);
void on_rfBW_currentIndexChanged(int index);
void on_rfBW_changed(quint64 value);
void on_afBW_valueChanged(int value);
void on_volume_valueChanged(int value);
void on_squelch_valueChanged(int value);

View File

@ -216,15 +216,56 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="rfBW">
<property name="maximumSize">
<widget class="ValueDial" name="rfBW" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>70</width>
<height>16777215</height>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="font">
<font>
<family>Liberation Mono</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string>RF Bandwidth (Hz)</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="rfBWUnits">
<property name="text">
<string>Hz</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="volumeLayout">
<item>
<widget class="QLabel" name="afBWLabel">
<property name="text">
@ -270,10 +311,6 @@
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="volumeLayout">
<item>
<widget class="QLabel" name="volumeLabel">
<property name="text">
@ -416,6 +453,12 @@
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDial</class>
<extends>QWidget</extends>
<header>gui/valuedial.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../../../sdrgui/resources/res.qrc"/>

View File

@ -24,10 +24,9 @@
#include "wfmdemodsettings.h"
const int WFMDemodSettings::m_rfBW[] = {
12500, 25000, 40000, 60000, 75000, 80000, 100000, 125000, 140000, 160000, 180000, 200000, 220000, 250000
};
const int WFMDemodSettings::m_nbRFBW = 14;
const int WFMDemodSettings::m_rfBWMin = 10000;
const int WFMDemodSettings::m_rfBWMax = 300000;
const int WFMDemodSettings::m_rfBWDigits = 6;
WFMDemodSettings::WFMDemodSettings() :
m_channelMarker(0)
@ -38,7 +37,7 @@ WFMDemodSettings::WFMDemodSettings() :
void WFMDemodSettings::resetToDefaults()
{
m_inputFrequencyOffset = 0;
m_rfBandwidth = getRFBW(5);
m_rfBandwidth = 80000;
m_afBandwidth = 15000;
m_volume = 2.0;
m_squelch = -60.0;
@ -57,7 +56,7 @@ QByteArray WFMDemodSettings::serialize() const
{
SimpleSerializer s(1);
s.writeS32(1, m_inputFrequencyOffset);
s.writeS32(2, getRFBWIndex(m_rfBandwidth));
s.writeS32(2, m_rfBandwidth);
s.writeS32(3, m_afBandwidth/1000.0);
s.writeS32(4, m_volume*10.0);
s.writeS32(5, m_squelch);
@ -98,7 +97,7 @@ bool WFMDemodSettings::deserialize(const QByteArray& data)
d.readS32(1, &tmp, 0);
m_inputFrequencyOffset = tmp;
d.readS32(2, &tmp, 4);
m_rfBandwidth = getRFBW(tmp);
m_rfBandwidth = tmp < m_rfBWMin ? m_rfBWMin : tmp > m_rfBWMax ? m_rfBWMax : tmp;
d.readS32(3, &tmp, 3);
m_afBandwidth = tmp * 1000.0;
d.readS32(4, &tmp, 20);
@ -138,28 +137,3 @@ bool WFMDemodSettings::deserialize(const QByteArray& data)
return false;
}
}
int WFMDemodSettings::getRFBW(int index)
{
if (index < 0) {
return m_rfBW[0];
} else if (index < m_nbRFBW) {
return m_rfBW[index];
} else {
return m_rfBW[m_nbRFBW-1];
}
}
int WFMDemodSettings::getRFBWIndex(int rfbw)
{
for (int i = 0; i < m_nbRFBW; i++)
{
if (rfbw <= m_rfBW[i])
{
return i;
}
}
return m_nbRFBW-1;
}

View File

@ -42,17 +42,15 @@ struct WFMDemodSettings
Serializable *m_channelMarker;
static const int m_nbRFBW;
static const int m_rfBW[];
static const int m_rfBWMin;
static const int m_rfBWMax;
static const int m_rfBWDigits;
WFMDemodSettings();
void resetToDefaults();
void setChannelMarker(Serializable *channelMarker) { m_channelMarker = channelMarker; }
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
static int getRFBW(int index);
static int getRFBWIndex(int rfbw);
};
#endif /* PLUGINS_CHANNELRX_DEMODWFM_WFMDEMODSETTINGS_H_ */