diff --git a/plugins/channelrx/demoddatv/datvdemod.h b/plugins/channelrx/demoddatv/datvdemod.h
index 9de91f350..f17835a47 100644
--- a/plugins/channelrx/demoddatv/datvdemod.h
+++ b/plugins/channelrx/demoddatv/datvdemod.h
@@ -66,6 +66,7 @@ public:
}
void SetTVScreen(TVScreen *objScreen) { m_basebandSink->setTVScreen(objScreen); }
+ void setMERLabel(QLabel *merLabel) { m_basebandSink->setMERLabel(merLabel); }
DATVideostream *SetVideoRender(DATVideoRender *objScreen) { return m_basebandSink->SetVideoRender(objScreen); }
bool audioActive() { return m_basebandSink->audioActive(); }
bool audioDecodeOK() { return m_basebandSink->audioDecodeOK(); }
diff --git a/plugins/channelrx/demoddatv/datvdemodbaseband.h b/plugins/channelrx/demoddatv/datvdemodbaseband.h
index 0a6d32cd4..be59c705b 100644
--- a/plugins/channelrx/demoddatv/datvdemodbaseband.h
+++ b/plugins/channelrx/demoddatv/datvdemodbaseband.h
@@ -86,6 +86,7 @@ public:
int getChannelSampleRate() const;
double getMagSq() const { return m_sink.getMagSq(); }
void setTVScreen(TVScreen *tvScreen) { m_sink.setTVScreen(tvScreen); }
+ void setMERLabel(QLabel *merLabel) { m_sink.setMERLabel(merLabel); }
void setMessageQueueToGUI(MessageQueue *messageQueue) { m_sink.setMessageQueueToGUI(messageQueue); }
void setBasebandSampleRate(int sampleRate); //!< To be used when supporting thread is stopped
DATVideostream *SetVideoRender(DATVideoRender *objScreen) { return m_sink.SetVideoRender(objScreen); }
@@ -115,4 +116,4 @@ private slots:
void handleData(); //!< Handle data when samples have to be processed
};
-#endif // INCLUDE_CHANNELANALYZERBASEBAND_H
\ No newline at end of file
+#endif // INCLUDE_CHANNELANALYZERBASEBAND_H
diff --git a/plugins/channelrx/demoddatv/datvdemodgui.cpp b/plugins/channelrx/demoddatv/datvdemodgui.cpp
index 94f4c74d8..6ca4a4f6d 100644
--- a/plugins/channelrx/demoddatv/datvdemodgui.cpp
+++ b/plugins/channelrx/demoddatv/datvdemodgui.cpp
@@ -195,6 +195,7 @@ DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Ba
m_objDATVDemod->setMessageQueueToGUI(getInputMessageQueue());
m_objDATVDemod->SetTVScreen(ui->screenTV);
+ m_objDATVDemod->setMERLabel(ui->merText);
connect(m_objDATVDemod->SetVideoRender(ui->screenTV_2), &DATVideostream::onDataPackets, this, &DATVDemodGUI::on_StreamDataAvailable);
connect(ui->screenTV_2, &DATVideoRender::onMetaDataChanged, this, &DATVDemodGUI::on_StreamMetaDataChanged);
diff --git a/plugins/channelrx/demoddatv/datvdemodgui.ui b/plugins/channelrx/demoddatv/datvdemodgui.ui
index 10bd25ba5..aa3e76eab 100644
--- a/plugins/channelrx/demoddatv/datvdemodgui.ui
+++ b/plugins/channelrx/demoddatv/datvdemodgui.ui
@@ -738,7 +738,7 @@
10
260
481
- 25
+ 33
@@ -825,6 +825,77 @@
+
+
+
+ 10
+ 300
+ 481
+ 31
+
+
+
+ -
+
+
+ MER
+
+
+
+ -
+
+
+
+ 28
+ 0
+
+
+
+ 00.0
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ CNR
+
+
+
+ -
+
+
+
+ 28
+ 0
+
+
+
+ 00.0
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
diff --git a/plugins/channelrx/demoddatv/datvdemodsink.cpp b/plugins/channelrx/demoddatv/datvdemodsink.cpp
index 06f4acfea..bcefe8d1e 100644
--- a/plugins/channelrx/demoddatv/datvdemodsink.cpp
+++ b/plugins/channelrx/demoddatv/datvdemodsink.cpp
@@ -32,11 +32,12 @@ const unsigned int DATVDemodSink::m_rfFilterFftLength = 1024;
DATVDemodSink::DATVDemodSink() :
m_blnNeedConfigUpdate(false),
- m_objRegisteredTVScreen(0),
- m_objRegisteredVideoRender(0),
+ m_objRegisteredTVScreen(nullptr),
+ m_objRegisteredVideoRender(nullptr),
m_objVideoStream(nullptr),
m_udpStream(leansdr::tspacket::SIZE),
m_objRenderThread(nullptr),
+ m_merLabel(nullptr),
m_audioFifo(48000),
m_blnRenderingVideo(false),
m_blnStartStopVideo(false),
@@ -86,6 +87,11 @@ bool DATVDemodSink::setTVScreen(TVScreen *objScreen)
return true;
}
+void DATVDemodSink::setMERLabel(QLabel *merLabel)
+{
+ m_merLabel = merLabel;
+}
+
DATVideostream *DATVDemodSink::SetVideoRender(DATVideoRender *objScreen)
{
m_objRegisteredVideoRender = objScreen;
@@ -341,6 +347,9 @@ void DATVDemodSink::CleanUpDATVFramework(bool blnRelease)
if (r_scope_symbols != nullptr) {
delete r_scope_symbols;
}
+ if (r_merGauge != nullptr) {
+ delete r_merGauge;
+ }
// INPUT
//if(p_rawiq!=nullptr) delete p_rawiq;
@@ -494,6 +503,7 @@ void DATVDemodSink::CleanUpDATVFramework(bool blnRelease)
//CONSTELLATION
r_scope_symbols = nullptr;
+ r_merGauge = nullptr;
//DVB-S2
p_slots_dvbs2 = nullptr;
@@ -765,6 +775,10 @@ void DATVDemodSink::InitDATVFramework()
r_scope_symbols->calculate_cstln_points();
}
+ if (m_merLabel) {
+ r_merGauge = new leansdr::datvgaugelabel(m_objScheduler, *p_mer, m_merLabel);
+ }
+
// DECONVOLUTION AND SYNCHRONIZATION
p_bytes = new leansdr::pipebuf(m_objScheduler, "bytes", BUF_BYTES);
@@ -1027,7 +1041,7 @@ void DATVDemodSink::InitDATVS2Framework()
*(leansdr::pipebuf< leansdr::plslot > *) p_slots_dvbs2,
/* p_freq */ nullptr,
/* p_ss */ nullptr,
- /* p_mer */ nullptr,
+ p_mer,
p_cstln,
/* p_cstln_pls */ nullptr,
/*p_iqsymbols*/ nullptr,
@@ -1069,6 +1083,10 @@ void DATVDemodSink::InitDATVS2Framework()
r_scope_symbols_dvbs2->calculate_cstln_points();
}
+ if (m_merLabel) {
+ r_merGauge = new leansdr::datvgaugelabel(m_objScheduler, *p_mer, m_merLabel);
+ }
+
// Bit-flipping mode.
// Deinterleave into hard bits.
diff --git a/plugins/channelrx/demoddatv/datvdemodsink.h b/plugins/channelrx/demoddatv/datvdemodsink.h
index 091d86a04..6ead8553a 100644
--- a/plugins/channelrx/demoddatv/datvdemodsink.h
+++ b/plugins/channelrx/demoddatv/datvdemodsink.h
@@ -28,6 +28,7 @@
#include "leansdr/iess.h"
#include "datvconstellation.h"
+#include "datvgaugelabel.h"
#include "datvdvbs2constellation.h"
#include "datvvideoplayer.h"
#include "datvideostream.h"
@@ -47,6 +48,7 @@
class TVScreen;
class DATVideoRender;
+class QLabel;
class DATVDemodSink : public ChannelSampleSink {
public:
@@ -56,6 +58,7 @@ public:
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);
bool setTVScreen(TVScreen *objScreen);
+ void setMERLabel(QLabel *merLabel);
DATVideostream * SetVideoRender(DATVideoRender *objScreen);
bool audioActive();
bool audioDecodeOK();
@@ -271,6 +274,7 @@ private:
//CONSTELLATION
leansdr::datvconstellation *r_scope_symbols;
leansdr::datvdvbs2constellation *r_scope_symbols_dvbs2;
+ leansdr::datvgaugelabel *r_merGauge;
//*************** DATV PARAMETERS ***************
TVScreen *m_objRegisteredTVScreen;
@@ -278,6 +282,7 @@ private:
DATVideostream *m_objVideoStream;
DATVUDPStream m_udpStream;
DATVideoRenderThread *m_objRenderThread;
+ QLabel *m_merLabel;
// Audio
AudioFifo m_audioFifo;
@@ -305,4 +310,4 @@ private:
static const unsigned int m_rfFilterFftLength;
};
-#endif // INCLUDE_DATVDEMODSINK_H
\ No newline at end of file
+#endif // INCLUDE_DATVDEMODSINK_H
diff --git a/plugins/channelrx/demoddatv/datvgaugelabel.h b/plugins/channelrx/demoddatv/datvgaugelabel.h
new file mode 100644
index 000000000..69ea5b03d
--- /dev/null
+++ b/plugins/channelrx/demoddatv/datvgaugelabel.h
@@ -0,0 +1,58 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2021 Edouard Griffiths, F4EXB //
+// using LeanSDR Framework (C) 2016 F4DAV //
+// //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation as version 3 of the License, or //
+// (at your option) any later version. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License V3 for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#ifndef DATVGAUGELABEL_H
+#define DATVGAUGELABEL_H
+
+#include
+#include
+
+#include "leansdr/framework.h"
+#include "leansdr/sdr.h"
+
+namespace leansdr {
+
+struct datvgaugelabel: runnable
+{
+ leansdr::pipereader m_in;
+ QLabel *m_label;
+ datvgaugelabel(
+ scheduler *sch,
+ leansdr::pipebuf &in,
+ QLabel *label = nullptr,
+ const char *_name = nullptr
+ ) :
+ runnable(sch, _name ? _name : in.name),
+ m_in(in),
+ m_label(label)
+ {}
+
+ virtual void run()
+ {
+ while (m_in.readable() >= 1)
+ {
+ leansdr::f32 *p = m_in.rd();
+ m_label->setText(QString("%1").arg(*p, 0, 'f', 1));
+ m_in.read(1);
+ }
+ }
+};
+
+} // namespace leansdr
+
+#endif // DATVGAUGELABEL_H
diff --git a/plugins/channelrx/demoddatv/leansdr/sdr.h b/plugins/channelrx/demoddatv/leansdr/sdr.h
index 69b48a858..b341b3f1d 100644
--- a/plugins/channelrx/demoddatv/leansdr/sdr.h
+++ b/plugins/channelrx/demoddatv/leansdr/sdr.h
@@ -1155,7 +1155,12 @@ struct cstln_receiver : runnable
int max_meas = chunk_size / meas_decimation + 1;
// Large margin on output_size because mu adjustments
// can lead to more than chunk_size/min_omega symbols.
- while (in.readable() >= chunk_size + sampler->readahead() && out.writable() >= chunk_size && (!freq_out || freq_out->writable() >= max_meas) && (!ss_out || ss_out->writable() >= max_meas) && (!mer_out || mer_out->writable() >= max_meas) && (!cstln_out || cstln_out->writable() >= max_meas))
+ while (in.readable() >= chunk_size + sampler->readahead() &&
+ out.writable() >= chunk_size &&
+ (!freq_out || freq_out->writable() >= max_meas) &&
+ (!ss_out || ss_out->writable() >= max_meas) &&
+ (!mer_out || mer_out->writable() >= max_meas) &&
+ (!cstln_out || cstln_out->writable() >= max_meas))
{
sampler->update_freq(freqw, chunk_size);