From 4716d39bcde7a361f2dbb6d9f4c43fa20e902bd1 Mon Sep 17 00:00:00 2001 From: Alex Spataru Date: Fri, 12 Feb 2021 12:06:09 -0500 Subject: [PATCH] Set UI refresh frequency to 40 Hz --- src/IO/Console.cpp | 2 +- src/Misc/TimerEvents.cpp | 10 +++++----- src/Misc/TimerEvents.h | 4 ++-- src/UI/GraphProvider.cpp | 2 +- src/UI/WidgetProvider.cpp | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/IO/Console.cpp b/src/IO/Console.cpp index 1d7b25fe..b4ea2ac0 100644 --- a/src/IO/Console.cpp +++ b/src/IO/Console.cpp @@ -54,7 +54,7 @@ Console::Console() // Read received data automatically auto dm = Manager::getInstance(); auto te = Misc::TimerEvents::getInstance(); - connect(te, SIGNAL(timeout24Hz()), this, SLOT(displayData())); + connect(te, SIGNAL(timeout40Hz()), this, SLOT(displayData())); connect(dm, &Manager::dataReceived, this, &Console::onDataReceived); // Log something to look like a pro diff --git a/src/Misc/TimerEvents.cpp b/src/Misc/TimerEvents.cpp index 43cbcfa4..3aa26db4 100644 --- a/src/Misc/TimerEvents.cpp +++ b/src/Misc/TimerEvents.cpp @@ -41,15 +41,15 @@ TimerEvents::TimerEvents() { // Configure timeout intevals m_timer1Hz.setInterval(HZ_TO_MS(1)); - m_timer24Hz.setInterval(HZ_TO_MS(40)); + m_timer40Hz.setInterval(HZ_TO_MS(40)); // Configure timer precision m_timer1Hz.setTimerType(Qt::PreciseTimer); - m_timer24Hz.setTimerType(Qt::PreciseTimer); + m_timer40Hz.setTimerType(Qt::PreciseTimer); // Configure signals/slots connect(&m_timer1Hz, &QTimer::timeout, this, &TimerEvents::timeout1Hz); - connect(&m_timer24Hz, &QTimer::timeout, this, &TimerEvents::timeout24Hz); + connect(&m_timer40Hz, &QTimer::timeout, this, &TimerEvents::timeout24Hz); LOG_TRACE() << "Class initialized"; } @@ -70,7 +70,7 @@ TimerEvents *TimerEvents::getInstance() void TimerEvents::stopTimers() { m_timer1Hz.stop(); - m_timer24Hz.stop(); + m_timer40Hz.stop(); LOG_INFO() << "Timers stopped"; } @@ -81,7 +81,7 @@ void TimerEvents::stopTimers() void TimerEvents::startTimers() { m_timer1Hz.start(); - m_timer24Hz.start(); + m_timer40Hz.start(); LOG_TRACE() << "Timers started"; } diff --git a/src/Misc/TimerEvents.h b/src/Misc/TimerEvents.h index a9e60279..f6069e3e 100644 --- a/src/Misc/TimerEvents.h +++ b/src/Misc/TimerEvents.h @@ -34,7 +34,7 @@ class TimerEvents : public QObject signals: void timeout1Hz(); - void timeout24Hz(); + void timeout40Hz(); public: static TimerEvents *getInstance(); @@ -47,7 +47,7 @@ private: TimerEvents(); private: - QTimer m_timer24Hz; + QTimer m_timer40Hz; QTimer m_timer1Hz; }; } diff --git a/src/UI/GraphProvider.cpp b/src/UI/GraphProvider.cpp index de4ff4b8..260fdd45 100644 --- a/src/UI/GraphProvider.cpp +++ b/src/UI/GraphProvider.cpp @@ -70,7 +70,7 @@ GraphProvider::GraphProvider() auto ge = JSON::Generator::getInstance(); auto te = Misc::TimerEvents::getInstance(); connect(cp, SIGNAL(openChanged()), this, SLOT(resetData())); - connect(te, SIGNAL(timeout24Hz()), this, SIGNAL(dataUpdated())); + connect(te, SIGNAL(timeout40Hz()), this, SIGNAL(dataUpdated())); connect(ge, SIGNAL(frameChanged()), this, SLOT(updateValues())); connect(io, SIGNAL(connectedChanged()), this, SLOT(resetData())); diff --git a/src/UI/WidgetProvider.cpp b/src/UI/WidgetProvider.cpp index 746a79c0..9a9188d5 100644 --- a/src/UI/WidgetProvider.cpp +++ b/src/UI/WidgetProvider.cpp @@ -51,7 +51,7 @@ WidgetProvider::WidgetProvider() auto ge = JSON::Generator::getInstance(); auto te = Misc::TimerEvents::getInstance(); connect(cp, SIGNAL(openChanged()), this, SLOT(resetData())); - connect(te, SIGNAL(timeout24Hz()), this, SIGNAL(dataChanged())); + connect(te, SIGNAL(timeout40Hz()), this, SIGNAL(dataChanged())); connect(ge, SIGNAL(frameChanged()), this, SLOT(updateModels())); connect(io, SIGNAL(connectedChanged()), this, SLOT(resetData())); LOG_TRACE() << "Class initialized";