1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-22 17:45:48 -05:00

use ValueDial for NFM channel shift thus allowing fine tuning

This commit is contained in:
f4exb 2015-05-10 15:13:29 +02:00
parent 95835fc8b7
commit 51a18d231a
3 changed files with 131 additions and 80 deletions

View File

@ -2,8 +2,6 @@
#include <QMainWindow>
#include "nfmdemodgui.h"
#include "ui_nfmdemodgui.h"
#include "nfmdemodgui.h"
#include "ui_nfmdemodgui.h"
#include "dsp/threadedsamplesink.h"
#include "dsp/channelizer.h"
#include "nfmdemod.h"
@ -13,6 +11,8 @@
#include "util/simpleserializer.h"
#include "gui/basicchannelsettingswidget.h"
#include <iostream>
const int NFMDemodGUI::m_rfBW[] = {
5000, 6250, 8330, 10000, 12500, 15000, 20000, 25000, 40000
};
@ -39,7 +39,7 @@ void NFMDemodGUI::resetToDefaults()
ui->afBW->setValue(3);
ui->volume->setValue(20);
ui->squelch->setValue(-40);
ui->fcenter->display(0);
ui->deltaFrequency->setValue(0);
ui->spectrumGUI->resetToDefaults();
applySettings();
}
@ -102,6 +102,26 @@ void NFMDemodGUI::viewChanged()
applySettings();
}
void NFMDemodGUI::on_deltaMinus_clicked(bool minus)
{
int deltaFrequency = m_channelMarker->getCenterFrequency();
bool minusDelta = (deltaFrequency < 0);
if (minus ^ minusDelta) // sign change
{
m_channelMarker->setCenterFrequency(-deltaFrequency);
}
}
void NFMDemodGUI::on_deltaFrequency_changed(quint64 value)
{
if (ui->deltaMinus->isChecked()) {
m_channelMarker->setCenterFrequency(-value);
} else {
m_channelMarker->setCenterFrequency(value);
}
}
void NFMDemodGUI::on_rfBW_valueChanged(int value)
{
ui->rfBWText->setText(QString("%1 kHz").arg(m_rfBW[value] / 1000.0));
@ -203,7 +223,8 @@ void NFMDemodGUI::applySettings()
m_channelizer->configure(m_threadedSampleSink->getMessageQueue(),
48000,
m_channelMarker->getCenterFrequency());
ui->fcenter->display(m_channelMarker->getCenterFrequency());
ui->deltaFrequency->setValue(abs(m_channelMarker->getCenterFrequency()));
ui->deltaMinus->setChecked(m_channelMarker->getCenterFrequency() < 0);
m_nfmDemod->configure(m_threadedSampleSink->getMessageQueue(),
m_rfBW[ui->rfBW->value()],
ui->afBW->value() * 1000.0,

View File

@ -34,6 +34,8 @@ public:
private slots:
void viewChanged();
void on_deltaFrequency_changed(quint64 value);
void on_deltaMinus_clicked(bool minus);
void on_rfBW_valueChanged(int value);
void on_afBW_valueChanged(int value);
void on_volume_valueChanged(int value);

View File

@ -41,10 +41,16 @@
<property name="spacing">
<number>3</number>
</property>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>RF Bandwidth</string>
<item row="3" column="1">
<widget class="QSlider" name="volume">
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>20</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
@ -64,6 +70,46 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QRadioButton" name="deltaMinus">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Minus</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Squelch</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>AF Bandwidth</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSlider" name="squelch">
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>0</number>
</property>
<property name="value">
<number>-40</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="rfBWText">
<property name="minimumSize">
@ -80,10 +126,26 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>AF Bandwidth</string>
<string>RF Bandwidth</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="afBWText">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>3 kHz</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
@ -106,15 +168,8 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Volume</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="afBWText">
<item row="4" column="2">
<widget class="QLabel" name="squelchText">
<property name="minimumSize">
<size>
<width>50</width>
@ -122,30 +177,17 @@
</size>
</property>
<property name="text">
<string>3 kHz</string>
<string>-40dB</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Squelch</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSlider" name="volume">
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>20</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<string>Volume</string>
</property>
</widget>
</item>
@ -165,58 +207,38 @@
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSlider" name="squelch">
<property name="minimum">
<number>-100</number>
<item row="0" column="1">
<widget class="ValueDial" name="deltaFrequency" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>0</number>
</property>
<property name="value">
<number>-40</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QLabel" name="squelchText">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
<width>32</width>
<height>16</height>
</size>
</property>
<property name="text">
<string>-40dB</string>
<property name="font">
<font>
<family>Monospace</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="flabel">
<property name="text">
<string>df (Hz)</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLCDNumber" name="fcenter">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Frequency shift from center frequency&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>Demod shift frequency from center in Hz</string>
</property>
<property name="smallDecimalPoint">
<bool>true</bool>
</property>
<property name="digitCount">
<number>7</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="deltaUnits">
<property name="text">
<string>Hz</string>
</property>
</widget>
</item>
@ -292,6 +314,12 @@
<header>gui/rollupwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDial</class>
<extends>QWidget</extends>
<header>gui/valuedial.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>