From 52dafd994b531665fd13a71543a283e3b941cfe3 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 4 Oct 2015 07:14:44 +0200 Subject: [PATCH] WFM demod: added display of channel power in dB. Changed minus radio button for a iconified toggle button --- plugins/channel/wfm/wfmdemod.h | 2 + plugins/channel/wfm/wfmdemodgui.cpp | 11 +- plugins/channel/wfm/wfmdemodgui.h | 3 +- plugins/channel/wfm/wfmdemodgui.ui | 459 +++++++++++++++------------- 4 files changed, 266 insertions(+), 209 deletions(-) diff --git a/plugins/channel/wfm/wfmdemod.h b/plugins/channel/wfm/wfmdemod.h index 839d51c07..d0ef3f0a2 100644 --- a/plugins/channel/wfm/wfmdemod.h +++ b/plugins/channel/wfm/wfmdemod.h @@ -43,6 +43,8 @@ public: virtual void stop(); virtual bool handleMessage(const Message& cmd); + Real getMagSq() const { return m_movingAverage.average(); } + private: class MsgConfigureWFMDemod : public Message { MESSAGE_CLASS_DECLARATION diff --git a/plugins/channel/wfm/wfmdemodgui.cpp b/plugins/channel/wfm/wfmdemodgui.cpp index c19c66477..98d717393 100644 --- a/plugins/channel/wfm/wfmdemodgui.cpp +++ b/plugins/channel/wfm/wfmdemodgui.cpp @@ -8,7 +8,9 @@ #include "gui/glspectrum.h" #include "plugin/pluginapi.h" #include "util/simpleserializer.h" +#include "util/db.h" #include "gui/basicchannelsettingswidget.h" +#include "mainwindow.h" #include "wfmdemod.h" #include "wfmdemodgui.h" @@ -143,7 +145,7 @@ void WFMDemodGUI::viewChanged() applySettings(); } -void WFMDemodGUI::on_deltaMinus_clicked(bool minus) +void WFMDemodGUI::on_deltaMinus_toggled(bool minus) { int deltaFrequency = m_channelMarker.getCenterFrequency(); bool minusDelta = (deltaFrequency < 0); @@ -226,6 +228,8 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this); DSPEngine::instance()->addThreadedSink(m_threadedChannelizer); + connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); + //m_channelMarker = new ChannelMarker(this); m_channelMarker.setColor(Qt::blue); m_channelMarker.setBandwidth(12500); @@ -288,3 +292,8 @@ void WFMDemodGUI::enterEvent(QEvent*) blockApplySettings(false); } +void WFMDemodGUI::tick() +{ + Real powDb = CalcDb::dbPower(m_wfmDemod->getMagSq()); + ui->channelPower->setText(QString::number(powDb, 'f', 1)); +} diff --git a/plugins/channel/wfm/wfmdemodgui.h b/plugins/channel/wfm/wfmdemodgui.h index dba14f61e..2afcd0f6a 100644 --- a/plugins/channel/wfm/wfmdemodgui.h +++ b/plugins/channel/wfm/wfmdemodgui.h @@ -36,13 +36,14 @@ public: private slots: void viewChanged(); void on_deltaFrequency_changed(quint64 value); - void on_deltaMinus_clicked(bool minus); + void on_deltaMinus_toggled(bool minus); void on_rfBW_valueChanged(int value); void on_afBW_valueChanged(int value); void on_volume_valueChanged(int value); void on_squelch_valueChanged(int value); void onWidgetRolled(QWidget* widget, bool rollDown); void onMenuDoubleClicked(); + void tick(); private: Ui::WFMDemodGUI* ui; diff --git a/plugins/channel/wfm/wfmdemodgui.ui b/plugins/channel/wfm/wfmdemodgui.ui index 8e63dee35..8aafa4336 100644 --- a/plugins/channel/wfm/wfmdemodgui.ui +++ b/plugins/channel/wfm/wfmdemodgui.ui @@ -7,7 +7,7 @@ 0 0 302 - 138 + 399 @@ -18,14 +18,17 @@ 35 35 - 242 - 96 + 106 + 349 Settings - + + + 3 + 2 @@ -38,212 +41,252 @@ 2 - - 3 - - - - - 100 - - - 20 - - - Qt::Horizontal - - + + + + + + ... + + + + :/plus.png + :/minus.png + + + + true + + + + + + + + 0 + 0 + + + + + 32 + 16 + + + + + Monospace + 12 + + + + SizeVerCursor + + + Qt::StrongFocus + + + Demod shift frequency from center in Hz + + + + + + + Hz + + + + + + + Qt::RightToLeft + + + 0.0 + + + + + + + dB + + + + - - - - 8 - - - 1 - - - 4 - - - Qt::Horizontal - - + + + + + + RF BW + + + + + + + 8 + + + 1 + + + 4 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + 12.5kHz + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + - - - - Qt::RightToLeft - - - Minus - - + + + + + + AF BW + + + + + + + 1 + + + 20 + + + 1 + + + 3 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + 3 kHz + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + - - - - Squelch - - + + + + + + Vol + + + + + + + 100 + + + 20 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + 2.0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + - - - - AF Bandwidth - - - - - - - -100 - - - 0 - - - -40 - - - Qt::Horizontal - - - - - - - - 50 - 0 - - - - 12.5kHz - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - RF Bandwidth - - - - - - - - 50 - 0 - - - - 3 kHz - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 1 - - - 20 - - - 1 - - - 3 - - - Qt::Horizontal - - - - - - - - 50 - 0 - - - - -40dB - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Volume - - - - - - - - 50 - 0 - - - - 2.0 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 32 - 16 - - - - - Monospace - 12 - - - - SizeVerCursor - - - Qt::StrongFocus - - - Demod shift frequency from center in Hz - - - - - - - Hz - - + + + + + + Sq + + + + + + + -100 + + + 0 + + + -40 + + + Qt::Horizontal + + + + + + + + 50 + 0 + + + + -40dB + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + @@ -262,6 +305,8 @@ 1 - + + +