From 1d0cf9582d2d2b3641ed166939115028339e2d1f Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 25 Feb 2017 05:45:42 +0100 Subject: [PATCH] ATV demod: ATV screen: use internal 40ms (25 FPS) timer for refresh --- plugins/channelrx/demodatv/atvdemodgui.cpp | 10 +++++----- plugins/channelrx/demodatv/atvscreen.cpp | 14 +++++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/plugins/channelrx/demodatv/atvdemodgui.cpp b/plugins/channelrx/demodatv/atvdemodgui.cpp index 7bffe2bfa..d8a86e959 100644 --- a/plugins/channelrx/demodatv/atvdemodgui.cpp +++ b/plugins/channelrx/demodatv/atvdemodgui.cpp @@ -191,7 +191,7 @@ ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI, m_objDeviceAPI->addChannelMarker(&m_objChannelMarker); m_objDeviceAPI->addRollupWidget(this); - ui->screenTV->connectTimer(m_objPluginAPI->getMainWindow()->getMasterTimer()); + //ui->screenTV->connectTimer(m_objPluginAPI->getMainWindow()->getMasterTimer()); //********** ATV Default values ********** ui->horizontalSlider->setValue(100); @@ -226,7 +226,7 @@ void ATVDemodGUI::applySettings() ATVModulation enmSelectedModulation; if (m_blnDoApplySettings) - { + { setTitleColor(m_objChannelMarker.getColor()); m_objChannelizer->configure(m_objChannelizer->getInputMessageQueue(), m_objATVDemod->GetSampleRate(), m_objChannelMarker.getCenterFrequency()); @@ -301,7 +301,7 @@ void ATVDemodGUI::on_horizontalSlider_2_valueChanged(int value) void ATVDemodGUI::on_horizontalSlider_3_valueChanged(int value) { ui->label_6->setText(QString("%1 uS").arg(((float)value)/10.0f)); - applySettings(); + applySettings(); } @@ -317,7 +317,7 @@ void ATVDemodGUI::on_checkBox_clicked() } void ATVDemodGUI::on_checkBox_2_clicked() -{ +{ applySettings(); } @@ -328,7 +328,7 @@ void ATVDemodGUI::on_checkBox_3_clicked() void ATVDemodGUI::on_comboBox_currentIndexChanged(int index) { - applySettings(); + applySettings(); } void ATVDemodGUI::on_comboBox_2_currentIndexChanged(int index) diff --git a/plugins/channelrx/demodatv/atvscreen.cpp b/plugins/channelrx/demodatv/atvscreen.cpp index 6336afe1b..91b29a72d 100644 --- a/plugins/channelrx/demodatv/atvscreen.cpp +++ b/plugins/channelrx/demodatv/atvscreen.cpp @@ -31,8 +31,8 @@ ATVScreen::ATVScreen(QWidget* parent) : QGLWidget(parent), m_objMutex(QMutex::NonRecursive) { setAttribute(Qt::WA_OpaquePaintEvent); - //connect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick())); - //m_objTimer.start(50); + connect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick())); + m_objTimer.start(40); // capped at 25 FPS m_chrLastData = NULL; m_blnConfigChanged = false; @@ -62,7 +62,8 @@ QRgb* ATVScreen::getRowBuffer(int intRow) void ATVScreen::renderImage(unsigned char * objData) { m_chrLastData = objData; - update(); + m_blnDataChanged = true; + //update(); } void ATVScreen::resetImage() @@ -148,6 +149,8 @@ void ATVScreen::paintGL() { m_objMutex.lock(); + m_blnDataChanged = false; + if (m_blnGLContextInitialized) { if ((m_intAskedCols != 0) && (m_intAskedRows != 0)) @@ -169,16 +172,17 @@ void ATVScreen::mousePressEvent(QMouseEvent* event) void ATVScreen::tick() { + if (m_blnDataChanged) { + update(); + } } void ATVScreen::connectTimer(const QTimer& objTimer) { - /* qDebug() << "ATVScreen::connectTimer"; disconnect(&m_objTimer, SIGNAL(timeout()), this, SLOT(tick())); connect(&objTimer, SIGNAL(timeout()), this, SLOT(tick())); m_objTimer.stop(); - */ } void ATVScreen::cleanup()