Commit 5b6fa856 authored by pixhawk's avatar pixhawk

Working on second linechartplot time mode

parent 80e1204f
......@@ -56,6 +56,7 @@ maxInterval(MAX_STORAGE_INTERVAL),
timeScaleStep(DEFAULT_SCALE_INTERVAL), // 10 seconds
automaticScrollActive(false),
m_active(true),
m_groundTime(false),
d_data(NULL),
d_curve(NULL)
{
......@@ -232,7 +233,16 @@ void LinechartPlot::appendData(QString dataname, quint64 ms, double value)
TimeSeriesData* dataset = data.value(dataname);
// Append data
dataset->append(ms, value);
if (m_groundTime)
{
// Use the current (receive) time
dataset->append(MG::TIME::getGroundTimeNow(), value);
}
else
{
// Use timestamp from dataset
dataset->append(ms, value);
}
// Scaling values
if(ms < minTime) minTime = ms;
......@@ -253,6 +263,14 @@ void LinechartPlot::appendData(QString dataname, quint64 ms, double value)
datalock.unlock();
}
/**
* @param enforce true to reset the data timestamp with the receive / ground timestamp
*/
void LinechartPlot::enforceGroundTime(bool enforce)
{
m_groundTime = enforce;
}
void LinechartPlot::addCurve(QString id)
{
QColor currentColor = getNextColor();
......
......@@ -241,6 +241,9 @@ public slots:
//void showCurve(QString id, int position);
void setCurveColor(QString id, QColor color);
/** @brief Enforce the use of the receive timestamp */
void enforceGroundTime(bool enforce);
// General interaction
void setWindowPosition(quint64 end);
void setPlotInterval(int interval);
......@@ -292,6 +295,7 @@ protected:
QTime lastMaxTimeAdded;
int plotid;
bool m_active; ///< Decides wether the plot is active or not
bool m_groundTime; ///< Enforce the use of the receive timestamp instead of the data timestamp
// Methods
void addCurve(QString id);
......
......@@ -152,6 +152,14 @@ void LinechartWidget::createLayout()
layout->setColumnStretch(3, 0);
connect(logButton, SIGNAL(clicked()), this, SLOT(startLogging()));
// Ground time button
QToolButton* timeButton = new QToolButton(this);
timeButton->setText(tr("Ground Time"));
timeButton->setCheckable(true);
layout->addWidget(timeButton, 1, 4);
layout->setColumnStretch(4, 0);
connect(timeButton, SIGNAL(clicked(bool)), activePlot, SLOT(enforceGroundTime(bool)));
// Create the scroll bar
scrollbar = new QScrollBar(Qt::Horizontal, ui.diagramGroupBox);
scrollbar->setMinimum(MIN_TIME_SCROLLBAR_VALUE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment