diff --git a/plugins/channel/bfm/bfmdemod.cpp b/plugins/channel/bfm/bfmdemod.cpp index 4a87278f2..80a9ac6cc 100644 --- a/plugins/channel/bfm/bfmdemod.cpp +++ b/plugins/channel/bfm/bfmdemod.cpp @@ -69,9 +69,15 @@ BFMDemod::~BFMDemod() DSPEngine::instance()->removeAudioSink(&m_audioFifo); } -void BFMDemod::configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioStereo) +void BFMDemod::configure(MessageQueue* messageQueue, + Real rfBandwidth, + Real afBandwidth, + Real volume, + Real squelch, + bool audioStereo, + bool showPilot) { - Message* cmd = MsgConfigureBFMDemod::create(rfBandwidth, afBandwidth, volume, squelch, audioStereo); + Message* cmd = MsgConfigureBFMDemod::create(rfBandwidth, afBandwidth, volume, squelch, audioStereo, showPilot); messageQueue->push(cmd); } @@ -123,17 +129,23 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto m_m2Sample = m_m1Sample; m_m1Sample = rf[i]; - m_sampleBuffer.push_back(Sample(demod * (1<<15), 0.0)); + if (!m_running.m_showPilot) + { + m_sampleBuffer.push_back(Sample(demod * (1<<15), 0.0)); + } + Real sampleStereo; // Process stereo if stereo mode is selected if (m_running.m_audioStereo) { - //Real pilotSample; - //m_pilotPLL.process(demod, pilotSample); m_pilotPLL.process(demod, m_pilotPLLSamples); - //m_sampleBuffer.push_back(Sample(pilotSample * (1<<15), 0.0)); // debug pilot + + if (m_running.m_showPilot) + { + m_sampleBuffer.push_back(Sample(m_pilotPLLSamples[1] * (1<<15), 0.0)); // debug 38 kHz pilot + } Complex s(demod*2.0*m_pilotPLLSamples[1], 0); @@ -243,6 +255,7 @@ bool BFMDemod::handleMessage(const Message& cmd) m_config.m_volume = cfg.getVolume(); m_config.m_squelch = cfg.getSquelch(); m_config.m_audioStereo = cfg.getAudioStereo(); + m_config.m_showPilot = cfg.getShowPilot(); apply(); @@ -250,7 +263,8 @@ bool BFMDemod::handleMessage(const Message& cmd) << " m_afBandwidth: " << m_config.m_afBandwidth << " m_volume: " << m_config.m_volume << " m_squelch: " << m_config.m_squelch - << " m_audioStereo: " << m_config.m_audioStereo; + << " m_audioStereo: " << m_config.m_audioStereo + << " m_showPilot: " << m_config.m_showPilot; return true; } @@ -341,5 +355,6 @@ void BFMDemod::apply() m_running.m_volume = m_config.m_volume; m_running.m_audioSampleRate = m_config.m_audioSampleRate; m_running.m_audioStereo = m_config.m_audioStereo; + m_running.m_showPilot = m_config.m_showPilot; } diff --git a/plugins/channel/bfm/bfmdemod.h b/plugins/channel/bfm/bfmdemod.h index 9dc2fcba3..d63be9c27 100644 --- a/plugins/channel/bfm/bfmdemod.h +++ b/plugins/channel/bfm/bfmdemod.h @@ -38,7 +38,13 @@ public: BFMDemod(SampleSink* sampleSink); virtual ~BFMDemod(); - void configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioStereo); + void configure(MessageQueue* messageQueue, + Real rfBandwidth, + Real afBandwidth, + Real volume, + Real squelch, + bool audioStereo, + bool showPilot); int getSampleRate() const { return m_config.m_inputSampleRate; } virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po); @@ -60,10 +66,16 @@ private: Real getVolume() const { return m_volume; } Real getSquelch() const { return m_squelch; } bool getAudioStereo() const { return m_audioStereo; } + bool getShowPilot() const { return m_showPilot; } - static MsgConfigureBFMDemod* create(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioStereo) + static MsgConfigureBFMDemod* create(Real rfBandwidth, + Real afBandwidth, + Real volume, + Real squelch, + bool audioStereo, + bool showPilot) { - return new MsgConfigureBFMDemod(rfBandwidth, afBandwidth, volume, squelch, audioStereo); + return new MsgConfigureBFMDemod(rfBandwidth, afBandwidth, volume, squelch, audioStereo, showPilot); } private: @@ -72,14 +84,21 @@ private: Real m_volume; Real m_squelch; bool m_audioStereo; + bool m_showPilot; - MsgConfigureBFMDemod(Real rfBandwidth, Real afBandwidth, Real volume, Real squelch, bool audioStereo) : + MsgConfigureBFMDemod(Real rfBandwidth, + Real afBandwidth, + Real volume, + Real squelch, + bool audioStereo, + bool showPilot) : Message(), m_rfBandwidth(rfBandwidth), m_afBandwidth(afBandwidth), m_volume(volume), m_squelch(squelch), - m_audioStereo(audioStereo) + m_audioStereo(audioStereo), + m_showPilot(showPilot) { } }; @@ -103,6 +122,7 @@ private: Real m_volume; quint32 m_audioSampleRate; bool m_audioStereo; + bool m_showPilot; Config() : m_inputSampleRate(-1), @@ -112,7 +132,8 @@ private: m_squelch(0), m_volume(0), m_audioSampleRate(0), - m_audioStereo(false) + m_audioStereo(false), + m_showPilot(false) { } }; diff --git a/plugins/channel/bfm/bfmdemodgui.cpp b/plugins/channel/bfm/bfmdemodgui.cpp index c4ae07fd9..f12a89a33 100644 --- a/plugins/channel/bfm/bfmdemodgui.cpp +++ b/plugins/channel/bfm/bfmdemodgui.cpp @@ -232,6 +232,11 @@ void BFMDemodGUI::on_audioStereo_toggled(bool stereo) applySettings(); } +void BFMDemodGUI::on_showPilot_clicked() +{ + applySettings(); +} + void BFMDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown) { } @@ -325,7 +330,8 @@ void BFMDemodGUI::applySettings() ui->afBW->value() * 1000.0, ui->volume->value() / 10.0, ui->squelch->value(), - ui->audioStereo->isChecked()); + ui->audioStereo->isChecked(), + ui->showPilot->isChecked()); } } @@ -349,6 +355,11 @@ void BFMDemodGUI::tick() m_channelPowerDbAvg.feed(powDb); ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1)); + Real pilotPowDb = CalcDb::dbPower(m_bfmDemod->getPilotLevel()); + QString pilotPowDbStr; + pilotPowDbStr.sprintf("%+02.1f", pilotPowDb); + ui->pilotPower->setText(pilotPowDbStr); + if (m_bfmDemod->getPilotLock()) { if (ui->audioStereo->isChecked()) diff --git a/plugins/channel/bfm/bfmdemodgui.h b/plugins/channel/bfm/bfmdemodgui.h index 3162aa7b0..4aaad51c1 100644 --- a/plugins/channel/bfm/bfmdemodgui.h +++ b/plugins/channel/bfm/bfmdemodgui.h @@ -62,6 +62,7 @@ private slots: void on_volume_valueChanged(int value); void on_squelch_valueChanged(int value); void on_audioStereo_toggled(bool stereo); + void on_showPilot_clicked(); void onWidgetRolled(QWidget* widget, bool rollDown); void onMenuDoubleClicked(); void tick(); diff --git a/plugins/channel/bfm/bfmdemodgui.ui b/plugins/channel/bfm/bfmdemodgui.ui index dc984a364..396c00e4a 100644 --- a/plugins/channel/bfm/bfmdemodgui.ui +++ b/plugins/channel/bfm/bfmdemodgui.ui @@ -6,7 +6,7 @@ 0 0 - 252 + 308 333 @@ -21,7 +21,7 @@ 10 20 - 235 + 281 121 @@ -160,6 +160,49 @@ + + + + Toggle demod/pilot spectrum display + + + + + + + :/carrier.png:/carrier.png + + + true + + + true + + + + + + + + 30 + 0 + + + + Pilot power + + + 0.0 + + + + + + + dB + + + @@ -343,8 +386,8 @@ 10 160 - 231 - 156 + 281 + 151 @@ -376,6 +419,11 @@ + + ButtonSwitch + QToolButton +
gui/buttonswitch.h
+
RollupWidget QWidget diff --git a/sdrbase/resources/carrier.png b/sdrbase/resources/carrier.png new file mode 100644 index 000000000..f6c091de2 Binary files /dev/null and b/sdrbase/resources/carrier.png differ diff --git a/sdrbase/resources/res.qrc b/sdrbase/resources/res.qrc index b74382026..03ce4800e 100644 --- a/sdrbase/resources/res.qrc +++ b/sdrbase/resources/res.qrc @@ -45,5 +45,6 @@ usb.png flip_lr.png flip_rl.png + carrier.png