mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-15 05:22:53 +08:00
Draw graph & widgets @ 24 FPS
This commit is contained in:
parent
826b601897
commit
733a659ba1
@ -23,7 +23,6 @@
|
|||||||
#ifndef UI_DATA_PROVIDER_H
|
#ifndef UI_DATA_PROVIDER_H
|
||||||
#define UI_DATA_PROVIDER_H
|
#define UI_DATA_PROVIDER_H
|
||||||
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <JSON/Frame.h>
|
#include <JSON/Frame.h>
|
||||||
|
|
||||||
|
@ -75,8 +75,9 @@ GraphProvider::GraphProvider()
|
|||||||
connect(CSV::Player::getInstance(), SIGNAL(timestampChanged()),
|
connect(CSV::Player::getInstance(), SIGNAL(timestampChanged()),
|
||||||
this, SLOT(csvPlayerFixes()));
|
this, SLOT(csvPlayerFixes()));
|
||||||
|
|
||||||
// Draw data every 50 ms
|
// Draw data at 24 FPS
|
||||||
QTimer::singleShot(50, this, SLOT(drawData()));
|
connect(&m_timer, &QTimer::timeout, this, &GraphProvider::dataUpdated);
|
||||||
|
m_timer.start(1000 / 24);
|
||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
LOG_TRACE() << "Class initialized";
|
LOG_TRACE() << "Class initialized";
|
||||||
@ -188,12 +189,6 @@ void GraphProvider::setDisplayedPoints(const int points)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphProvider::drawData()
|
|
||||||
{
|
|
||||||
emit dataUpdated();
|
|
||||||
QTimer::singleShot(500, this, SLOT(drawData()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes all stored information
|
* Deletes all stored information
|
||||||
*/
|
*/
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#ifndef GRAPH_PROVIDER_H
|
#ifndef GRAPH_PROVIDER_H
|
||||||
#define GRAPH_PROVIDER_H
|
#define GRAPH_PROVIDER_H
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
@ -75,12 +76,12 @@ private:
|
|||||||
GraphProvider();
|
GraphProvider();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void drawData();
|
|
||||||
void resetData();
|
void resetData();
|
||||||
void updateValues();
|
void updateValues();
|
||||||
void csvPlayerFixes();
|
void csvPlayerFixes();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QTimer m_timer;
|
||||||
int m_prevFramePos;
|
int m_prevFramePos;
|
||||||
int m_displayedPoints;
|
int m_displayedPoints;
|
||||||
QVector<double> m_maximumValues;
|
QVector<double> m_maximumValues;
|
||||||
|
@ -51,6 +51,10 @@ WidgetProvider::WidgetProvider()
|
|||||||
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()));
|
||||||
|
|
||||||
|
// Draw data at 24 FPS
|
||||||
|
connect(&m_timer, &QTimer::timeout, this, &WidgetProvider::dataChanged);
|
||||||
|
m_timer.start(1000 / 24);
|
||||||
|
|
||||||
// Look like a pro
|
// Look like a pro
|
||||||
LOG_TRACE() << "Class initialized";
|
LOG_TRACE() << "Class initialized";
|
||||||
}
|
}
|
||||||
@ -419,9 +423,6 @@ void WidgetProvider::updateModels()
|
|||||||
m_gyroGroups = getWidgetGroup("gyro");
|
m_gyroGroups = getWidgetGroup("gyro");
|
||||||
m_barDatasets = getWidgetDatasets("bar");
|
m_barDatasets = getWidgetDatasets("bar");
|
||||||
m_accelerometerGroups = getWidgetGroup("accelerometer");
|
m_accelerometerGroups = getWidgetGroup("accelerometer");
|
||||||
|
|
||||||
// Update UI
|
|
||||||
emit dataChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#define WIDGETPROVIDER_H
|
#define WIDGETPROVIDER_H
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QTimer>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <JSON/Frame.h>
|
#include <JSON/Frame.h>
|
||||||
|
|
||||||
@ -87,6 +88,7 @@ private:
|
|||||||
QList<JSON::Dataset *> getWidgetDatasets(const QString &handle);
|
QList<JSON::Dataset *> getWidgetDatasets(const QString &handle);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QTimer m_timer;
|
||||||
QList<JSON::Group *> m_mapGroups;
|
QList<JSON::Group *> m_mapGroups;
|
||||||
QList<JSON::Group *> m_gyroGroups;
|
QList<JSON::Group *> m_gyroGroups;
|
||||||
QList<JSON::Dataset *> m_barDatasets;
|
QList<JSON::Dataset *> m_barDatasets;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user