diff --git a/plugins/channel/bfm/bfmdemod.h b/plugins/channel/bfm/bfmdemod.h index 89555637d..1ca9b260e 100644 --- a/plugins/channel/bfm/bfmdemod.h +++ b/plugins/channel/bfm/bfmdemod.h @@ -58,9 +58,15 @@ public: virtual bool handleMessage(const Message& cmd); Real getMagSq() const { return m_movingAverage.average(); } + bool getPilotLock() const { return m_pilotPLL.locked(); } Real getPilotLevel() const { return m_pilotPLL.get_pilot_level(); } + Real getDecoderQua() const { return m_rdsDecoder.m_qua; } + Real getDemodAcc() const { return m_rdsDemod.m_report.acc; } + Real getDemodQua() const { return m_rdsDemod.m_report.qua; } + Real getDemodFclk() const { return m_rdsDemod.m_report.fclk; } + private: class MsgConfigureBFMDemod : public Message { MESSAGE_CLASS_DECLARATION diff --git a/plugins/channel/bfm/bfmdemodgui.cpp b/plugins/channel/bfm/bfmdemodgui.cpp index 5fe4d5dd8..65c707658 100644 --- a/plugins/channel/bfm/bfmdemodgui.cpp +++ b/plugins/channel/bfm/bfmdemodgui.cpp @@ -413,6 +413,13 @@ void BFMDemodGUI::channelSampleRateChanged() void BFMDemodGUI::rdsUpdate() { + // Quality metrics + ui->demodQText->setText(QString::number(m_bfmDemod->getDemodQua(), 'f', 0)); + ui->decoderQText->setText(QString("%1").arg(m_bfmDemod->getDecoderQua())); + Real accDb = CalcDb::dbPower(std::fabs(m_bfmDemod->getDemodAcc())); + ui->accumText->setText(QString::number(accDb, 'f', 1)); + ui->fclkText->setText(QString::number(m_bfmDemod->getDemodFclk(), 'f', 2)); + // PI group if (m_rdsParser.m_pi_updated) { @@ -461,8 +468,7 @@ void BFMDemodGUI::rdsUpdate() { if (*it > 76.0) { - if (!isFirst) - { + if (!isFirst) { os << ", "; } diff --git a/plugins/channel/bfm/bfmdemodgui.ui b/plugins/channel/bfm/bfmdemodgui.ui index 514d76153..7e56ebb1f 100644 --- a/plugins/channel/bfm/bfmdemodgui.ui +++ b/plugins/channel/bfm/bfmdemodgui.ui @@ -6,7 +6,7 @@ 0 0 - 446 + 514 729 @@ -436,10 +436,16 @@ 10 150 - 421 - 91 + 500 + 141 + + + 500 + 0 + + RDS data @@ -447,6 +453,278 @@ 3 + + + + + + + 40 + 0 + + + + + 40 + 16777215 + + + + Dem Q + + + + + + + + 20 + 0 + + + + + 20 + 16777215 + + + + 0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 10 + 0 + + + + + 10 + 16777215 + + + + % + + + + + + + Qt::Vertical + + + + + + + + 40 + 0 + + + + + 40 + 16777215 + + + + Dec Q + + + + + + + + 20 + 0 + + + + + 20 + 16777215 + + + + 0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 10 + 0 + + + + + 10 + 16777215 + + + + % + + + + + + + Qt::Vertical + + + + + + + + 40 + 0 + + + + + 40 + 16777215 + + + + Acc + + + + + + + + 40 + 0 + + + + + 40 + 16777215 + + + + 0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 15 + 0 + + + + + 15 + 16777215 + + + + dB + + + + + + + Qt::Vertical + + + + + + + + 30 + 0 + + + + + 30 + 16777215 + + + + Fclk + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + 1187.50 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 15 + 0 + + + + + 15 + 16777215 + + + + Hz + + + + + + + + + Qt::Horizontal + + + diff --git a/plugins/channel/bfm/rdsdecoder.cpp b/plugins/channel/bfm/rdsdecoder.cpp index fb4f6b38a..7e7f7922b 100644 --- a/plugins/channel/bfm/rdsdecoder.cpp +++ b/plugins/channel/bfm/rdsdecoder.cpp @@ -184,18 +184,21 @@ bool RDSDecoder::frameSync(bool bit) { if (m_wrongBlocksCounter > 35) { + /* qDebug() << "RDSDecoder::frameSync: Lost Sync (Got " << m_wrongBlocksCounter << " bad blocks on " << m_blocksCounter - << " total)"; + << " total)";*/ enter_no_sync(); } else { + /* qDebug() << "RDSDecoder::frameSync: Still Sync-ed (Got " << m_wrongBlocksCounter << " bad blocks on " << m_blocksCounter - << " total)"; + << " total)";*/ } + m_qua = 2.0 * (50 - m_wrongBlocksCounter); m_blocksCounter = 0; m_wrongBlocksCounter = 0; } diff --git a/plugins/channel/bfm/rdsdecoder.h b/plugins/channel/bfm/rdsdecoder.h index bdf000d07..6b70d6635 100644 --- a/plugins/channel/bfm/rdsdecoder.h +++ b/plugins/channel/bfm/rdsdecoder.h @@ -27,6 +27,8 @@ public: bool frameSync(bool bit); unsigned int *getGroup() { return m_group; } + float m_qua; + protected: unsigned int calc_syndrome(unsigned long message, unsigned char mlen); void enter_sync(unsigned int sync_block_number); diff --git a/plugins/channel/bfm/rdsdemod.cpp b/plugins/channel/bfm/rdsdemod.cpp index fdd430bea..f45d324d7 100644 --- a/plugins/channel/bfm/rdsdemod.cpp +++ b/plugins/channel/bfm/rdsdemod.cpp @@ -143,14 +143,18 @@ bool RDSDemod::biphase(Real acc, bool& bit, Real d_cphi) m_parms.reading_frame = 1 - m_parms.reading_frame; } - Real qua = (1.0 * abs(m_parms.tot_errs[0] - m_parms.tot_errs[1]) / (m_parms.tot_errs[0] + m_parms.tot_errs[1])) * 100; + m_report.qua = (1.0 * abs(m_parms.tot_errs[0] - m_parms.tot_errs[1]) / (m_parms.tot_errs[0] + m_parms.tot_errs[1])) * 100; + m_report.acc = acc; + m_report.fclk = (d_cphi / (2 * M_PI)) * m_srate; + + /* qDebug("RDSDemod::biphase: frame: %d acc: %+6.3f errs: %3d %3d qual: %3.0f%% clk: %7.2f", m_parms.reading_frame, acc, m_parms.tot_errs[0], m_parms.tot_errs[1], - qua, - (d_cphi / (2 * M_PI)) * m_srate); + m_report.qua, + m_report.fclk);*/ m_parms.tot_errs[0] = 0; m_parms.tot_errs[1] = 0; diff --git a/plugins/channel/bfm/rdsdemod.h b/plugins/channel/bfm/rdsdemod.h index 203528e80..c10c7527a 100644 --- a/plugins/channel/bfm/rdsdemod.h +++ b/plugins/channel/bfm/rdsdemod.h @@ -34,6 +34,12 @@ public: void setSampleRate(int srate); bool process(Real rdsSample, bool &bit); + struct{ + Real acc; + Real qua; + Real fclk; + } m_report; + protected: bool biphase(Real acc, bool &bit, Real d_cphi); Real filter_lp_2400_iq(Real in, int iqIndex);