Set UI refresh frequency to 40 Hz

This commit is contained in:
Alex Spataru 2021-02-12 12:06:09 -05:00
parent 7dc22f90e0
commit 4716d39bcd
5 changed files with 10 additions and 10 deletions

View File

@ -54,7 +54,7 @@ Console::Console()
// Read received data automatically // Read received data automatically
auto dm = Manager::getInstance(); auto dm = Manager::getInstance();
auto te = Misc::TimerEvents::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); connect(dm, &Manager::dataReceived, this, &Console::onDataReceived);
// Log something to look like a pro // Log something to look like a pro

View File

@ -41,15 +41,15 @@ TimerEvents::TimerEvents()
{ {
// Configure timeout intevals // Configure timeout intevals
m_timer1Hz.setInterval(HZ_TO_MS(1)); m_timer1Hz.setInterval(HZ_TO_MS(1));
m_timer24Hz.setInterval(HZ_TO_MS(40)); m_timer40Hz.setInterval(HZ_TO_MS(40));
// Configure timer precision // Configure timer precision
m_timer1Hz.setTimerType(Qt::PreciseTimer); m_timer1Hz.setTimerType(Qt::PreciseTimer);
m_timer24Hz.setTimerType(Qt::PreciseTimer); m_timer40Hz.setTimerType(Qt::PreciseTimer);
// Configure signals/slots // Configure signals/slots
connect(&m_timer1Hz, &QTimer::timeout, this, &TimerEvents::timeout1Hz); 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"; LOG_TRACE() << "Class initialized";
} }
@ -70,7 +70,7 @@ TimerEvents *TimerEvents::getInstance()
void TimerEvents::stopTimers() void TimerEvents::stopTimers()
{ {
m_timer1Hz.stop(); m_timer1Hz.stop();
m_timer24Hz.stop(); m_timer40Hz.stop();
LOG_INFO() << "Timers stopped"; LOG_INFO() << "Timers stopped";
} }
@ -81,7 +81,7 @@ void TimerEvents::stopTimers()
void TimerEvents::startTimers() void TimerEvents::startTimers()
{ {
m_timer1Hz.start(); m_timer1Hz.start();
m_timer24Hz.start(); m_timer40Hz.start();
LOG_TRACE() << "Timers started"; LOG_TRACE() << "Timers started";
} }

View File

@ -34,7 +34,7 @@ class TimerEvents : public QObject
signals: signals:
void timeout1Hz(); void timeout1Hz();
void timeout24Hz(); void timeout40Hz();
public: public:
static TimerEvents *getInstance(); static TimerEvents *getInstance();
@ -47,7 +47,7 @@ private:
TimerEvents(); TimerEvents();
private: private:
QTimer m_timer24Hz; QTimer m_timer40Hz;
QTimer m_timer1Hz; QTimer m_timer1Hz;
}; };
} }

View File

@ -70,7 +70,7 @@ GraphProvider::GraphProvider()
auto ge = JSON::Generator::getInstance(); auto ge = JSON::Generator::getInstance();
auto te = Misc::TimerEvents::getInstance(); auto te = Misc::TimerEvents::getInstance();
connect(cp, SIGNAL(openChanged()), this, SLOT(resetData())); 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(ge, SIGNAL(frameChanged()), this, SLOT(updateValues()));
connect(io, SIGNAL(connectedChanged()), this, SLOT(resetData())); connect(io, SIGNAL(connectedChanged()), this, SLOT(resetData()));

View File

@ -51,7 +51,7 @@ WidgetProvider::WidgetProvider()
auto ge = JSON::Generator::getInstance(); auto ge = JSON::Generator::getInstance();
auto te = Misc::TimerEvents::getInstance(); auto te = Misc::TimerEvents::getInstance();
connect(cp, SIGNAL(openChanged()), this, SLOT(resetData())); 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(ge, SIGNAL(frameChanged()), this, SLOT(updateModels()));
connect(io, SIGNAL(connectedChanged()), this, SLOT(resetData())); connect(io, SIGNAL(connectedChanged()), this, SLOT(resetData()));
LOG_TRACE() << "Class initialized"; LOG_TRACE() << "Class initialized";