2010-08-10 07:42:39 +02:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file scopegadgetwidget.cpp
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* @addtogroup GCSPlugins GCS Plugins
|
|
|
|
* @{
|
|
|
|
* @addtogroup ScopePlugin Scope Gadget Plugin
|
|
|
|
* @{
|
|
|
|
* @brief The scope Gadget, graphically plots the states of UAVObjects
|
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "scopegadgetwidget.h"
|
2010-08-26 21:54:23 +02:00
|
|
|
#include "utils/stylehelper.h"
|
2010-08-10 07:42:39 +02:00
|
|
|
|
2011-01-20 23:30:49 +01:00
|
|
|
#include "extensionsystem/pluginmanager.h"
|
2011-01-22 18:38:22 +01:00
|
|
|
#include "uavobjectmanager.h"
|
|
|
|
#include "uavobject.h"
|
2011-01-20 23:30:49 +01:00
|
|
|
#include "coreplugin/icore.h"
|
|
|
|
#include "coreplugin/connectionmanager.h"
|
|
|
|
|
2010-08-10 07:42:39 +02:00
|
|
|
#include "qwt/src/qwt_plot_curve.h"
|
|
|
|
#include "qwt/src/qwt_legend.h"
|
|
|
|
#include "qwt/src/qwt_legend_item.h"
|
|
|
|
#include "qwt/src/qwt_plot_grid.h"
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <math.h>
|
|
|
|
#include <QDebug>
|
2014-01-26 16:54:24 +01:00
|
|
|
#include <QDir>
|
2010-08-10 07:42:39 +02:00
|
|
|
#include <QColor>
|
|
|
|
#include <QStringList>
|
2013-09-15 23:06:25 +02:00
|
|
|
#include <QWidget>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QPushButton>
|
2011-02-14 11:19:18 +01:00
|
|
|
#include <QMutexLocker>
|
2012-05-24 23:48:58 +02:00
|
|
|
#include <QWheelEvent>
|
2010-08-10 07:42:39 +02:00
|
|
|
|
|
|
|
ScopeGadgetWidget::ScopeGadgetWidget(QWidget *parent) : QwtPlot(parent)
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
setMouseTracking(true);
|
2014-01-26 16:54:24 +01:00
|
|
|
// canvas()->setMouseTracking(true);
|
2011-02-14 11:19:18 +01:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
// Setup the timer that replots data
|
2010-08-14 22:25:55 +02:00
|
|
|
replotTimer = new QTimer(this);
|
|
|
|
connect(replotTimer, SIGNAL(timeout()), this, SLOT(replotNewData()));
|
2011-01-20 23:30:49 +01:00
|
|
|
|
2012-05-24 23:48:58 +02:00
|
|
|
// Listen to telemetry connection/disconnection events, no point in
|
|
|
|
// running the scopes if we are not connected and not replaying logs.
|
2011-01-20 23:30:49 +01:00
|
|
|
// Also listen to disconnect actions from the user
|
|
|
|
Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager();
|
2011-03-25 11:59:24 +01:00
|
|
|
connect(cm, SIGNAL(deviceAboutToDisconnect()), this, SLOT(stopPlotting()));
|
2013-05-13 21:24:19 +02:00
|
|
|
connect(cm, SIGNAL(deviceConnected(QIODevice *)), this, SLOT(startPlotting()));
|
|
|
|
|
|
|
|
m_csvLoggingStarted = 0;
|
|
|
|
m_csvLoggingEnabled = 0;
|
|
|
|
m_csvLoggingHeaderSaved = 0;
|
|
|
|
m_csvLoggingDataSaved = 0;
|
|
|
|
m_csvLoggingDataUpdated = 0;
|
|
|
|
m_csvLoggingNameSet = 0;
|
|
|
|
m_csvLoggingConnected = 0;
|
|
|
|
m_csvLoggingNewFileOnConnect = 0;
|
2011-01-31 03:09:44 +01:00
|
|
|
m_csvLoggingPath = QString("./csvlogging/");
|
2013-05-13 21:24:19 +02:00
|
|
|
m_csvLoggingStartTime = QDateTime::currentDateTime();
|
2011-01-31 03:09:44 +01:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
// Listen to autopilot connection events
|
2011-03-25 11:59:24 +01:00
|
|
|
connect(cm, SIGNAL(deviceAboutToDisconnect()), this, SLOT(csvLoggingDisconnect()));
|
2013-05-13 21:24:19 +02:00
|
|
|
connect(cm, SIGNAL(deviceConnected(QIODevice *)), this, SLOT(csvLoggingConnect()));
|
2011-02-14 11:19:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ScopeGadgetWidget::~ScopeGadgetWidget()
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
if (replotTimer) {
|
|
|
|
replotTimer->stop();
|
|
|
|
|
|
|
|
delete replotTimer;
|
|
|
|
replotTimer = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the object to de-monitor
|
|
|
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
|
|
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
|
|
|
foreach(QString uavObjName, m_connectedUAVObjects) {
|
|
|
|
UAVDataObject *obj = dynamic_cast<UAVDataObject *>(objManager->getObject(uavObjName));
|
|
|
|
|
|
|
|
disconnect(obj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(uavObjectReceived(UAVObject *)));
|
|
|
|
}
|
|
|
|
|
|
|
|
clearCurvePlots();
|
2011-02-14 11:19:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScopeGadgetWidget::mousePressEvent(QMouseEvent *e)
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
QwtPlot::mousePressEvent(e);
|
2011-02-14 11:19:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScopeGadgetWidget::mouseReleaseEvent(QMouseEvent *e)
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
QwtPlot::mouseReleaseEvent(e);
|
2011-02-14 11:19:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScopeGadgetWidget::mouseDoubleClickEvent(QMouseEvent *e)
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
// On double-click, toggle legend
|
2012-05-24 23:48:58 +02:00
|
|
|
mutex.lock();
|
2013-05-13 21:24:19 +02:00
|
|
|
if (legend()) {
|
2012-05-24 23:48:58 +02:00
|
|
|
deleteLegend();
|
2013-05-13 21:24:19 +02:00
|
|
|
} else {
|
2012-05-24 23:48:58 +02:00
|
|
|
addLegend();
|
2013-05-13 21:24:19 +02:00
|
|
|
}
|
2012-05-24 23:48:58 +02:00
|
|
|
mutex.unlock();
|
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
// On double-click, reset plot zoom
|
2012-05-24 23:48:58 +02:00
|
|
|
setAxisAutoScale(QwtPlot::yLeft, true);
|
|
|
|
|
|
|
|
update();
|
2011-02-14 11:19:18 +01:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
QwtPlot::mouseDoubleClickEvent(e);
|
2011-02-14 11:19:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScopeGadgetWidget::mouseMoveEvent(QMouseEvent *e)
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
QwtPlot::mouseMoveEvent(e);
|
2011-02-14 11:19:18 +01:00
|
|
|
}
|
2011-01-31 03:09:44 +01:00
|
|
|
|
2011-02-14 11:19:18 +01:00
|
|
|
void ScopeGadgetWidget::wheelEvent(QWheelEvent *e)
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
// Change zoom on scroll wheel event
|
|
|
|
QwtInterval yInterval = axisInterval(QwtPlot::yLeft);
|
|
|
|
|
|
|
|
if (yInterval.minValue() != yInterval.maxValue()) { // Make sure that the two values are never the same. Sometimes axisInterval returns (0,0)
|
|
|
|
// Determine what y value to zoom about. NOTE, this approach has a bug that the in that
|
|
|
|
// the value returned by Qt includes the legend, whereas the value transformed by Qwt
|
|
|
|
// does *not*. Thus, when zooming with a legend, there will always be a small bias error.
|
|
|
|
// In practice, this seems not to be a UI problem.
|
|
|
|
QPoint mouse_pos = e->pos(); // Get the mouse coordinate in the frame
|
|
|
|
double zoomLine = invTransform(QwtPlot::yLeft, mouse_pos.y()); // Transform the y mouse coordinate into a frame value.
|
|
|
|
|
|
|
|
double zoomScale = 1.1; // THIS IS AN ARBITRARY CONSTANT, AND PERHAPS SHOULD BE IN A DEFINE INSTEAD OF BURIED HERE
|
|
|
|
|
|
|
|
mutex.lock(); // DOES THIS mutex.lock NEED TO BE HERE? I DON'T KNOW, I JUST COPIED IT FROM THE ABOVE CODE
|
2012-05-24 23:48:58 +02:00
|
|
|
// Set the scale
|
2013-05-13 21:24:19 +02:00
|
|
|
if (e->delta() < 0) {
|
2012-05-24 23:48:58 +02:00
|
|
|
setAxisScale(QwtPlot::yLeft,
|
2013-05-13 21:24:19 +02:00
|
|
|
(yInterval.minValue() - zoomLine) * zoomScale + zoomLine,
|
|
|
|
(yInterval.maxValue() - zoomLine) * zoomScale + zoomLine);
|
|
|
|
} else {
|
2012-05-24 23:48:58 +02:00
|
|
|
setAxisScale(QwtPlot::yLeft,
|
2013-05-13 21:24:19 +02:00
|
|
|
(yInterval.minValue() - zoomLine) / zoomScale + zoomLine,
|
|
|
|
(yInterval.maxValue() - zoomLine) / zoomScale + zoomLine);
|
2012-05-24 23:48:58 +02:00
|
|
|
}
|
|
|
|
mutex.unlock();
|
|
|
|
}
|
2012-05-22 11:34:01 +02:00
|
|
|
QwtPlot::wheelEvent(e);
|
2011-01-20 23:30:49 +01:00
|
|
|
}
|
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
void ScopeGadgetWidget::showEvent(QShowEvent *e)
|
|
|
|
{
|
|
|
|
replotNewData();
|
|
|
|
QwtPlot::showEvent(e);
|
|
|
|
}
|
|
|
|
|
2011-01-20 23:30:49 +01:00
|
|
|
/**
|
|
|
|
* Starts/stops telemetry
|
|
|
|
*/
|
2011-01-26 23:21:54 +01:00
|
|
|
void ScopeGadgetWidget::startPlotting()
|
2011-01-20 23:30:49 +01:00
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
if (!replotTimer) {
|
|
|
|
return;
|
|
|
|
}
|
2011-02-27 11:26:50 +01:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
if (!replotTimer->isActive()) {
|
2011-01-20 23:30:49 +01:00
|
|
|
replotTimer->start(m_refreshInterval);
|
2013-05-13 21:24:19 +02:00
|
|
|
}
|
2011-01-20 23:30:49 +01:00
|
|
|
}
|
|
|
|
|
2011-01-26 23:21:54 +01:00
|
|
|
void ScopeGadgetWidget::stopPlotting()
|
2011-01-20 23:30:49 +01:00
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
if (!replotTimer) {
|
|
|
|
return;
|
|
|
|
}
|
2011-02-27 11:26:50 +01:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
replotTimer->stop();
|
2010-08-10 07:42:39 +02:00
|
|
|
}
|
|
|
|
|
2011-02-14 11:19:18 +01:00
|
|
|
void ScopeGadgetWidget::deleteLegend()
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
if (!legend()) {
|
|
|
|
return;
|
|
|
|
}
|
2011-02-14 11:19:18 +01:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
disconnect(this, SIGNAL(legendChecked(QwtPlotItem *, bool)), this, 0);
|
2011-02-14 11:19:18 +01:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
insertLegend(NULL, QwtPlot::TopLegend);
|
2011-02-14 11:19:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScopeGadgetWidget::addLegend()
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
if (legend()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Show a legend at the top
|
|
|
|
QwtLegend *legend = new QwtLegend();
|
|
|
|
legend->setItemMode(QwtLegend::CheckableItem);
|
|
|
|
legend->setFrameStyle(QFrame::Box | QFrame::Sunken);
|
2014-01-26 16:54:24 +01:00
|
|
|
legend->setToolTip(tr("Click legend to show/hide scope trace.\nDouble click legend or plot to show/hide legend."));
|
2013-05-13 21:24:19 +02:00
|
|
|
|
2014-01-26 16:54:24 +01:00
|
|
|
// set colors
|
2013-05-13 21:24:19 +02:00
|
|
|
QPalette pal = legend->palette();
|
2014-01-26 16:54:24 +01:00
|
|
|
pal.setColor(legend->backgroundRole(), QColor(100, 100, 100));
|
|
|
|
pal.setColor(QPalette::Text, QColor(0, 0, 0));
|
2013-05-13 21:24:19 +02:00
|
|
|
legend->setPalette(pal);
|
|
|
|
|
|
|
|
insertLegend(legend, QwtPlot::TopLegend);
|
2011-02-14 11:19:18 +01:00
|
|
|
|
2012-05-24 23:48:58 +02:00
|
|
|
// Update the checked/unchecked state of the legend items
|
|
|
|
// -> this is necessary when hiding a legend where some plots are
|
2014-01-26 16:54:24 +01:00
|
|
|
// not visible, and then un-hiding it.
|
2013-05-13 21:24:19 +02:00
|
|
|
foreach(QwtPlotItem * item, this->itemList()) {
|
|
|
|
bool on = item->isVisible();
|
2012-05-24 23:48:58 +02:00
|
|
|
QWidget *w = legend->find(item);
|
2013-05-13 21:24:19 +02:00
|
|
|
|
|
|
|
if (w && w->inherits("QwtLegendItem")) {
|
2012-05-24 23:48:58 +02:00
|
|
|
((QwtLegendItem *)w)->setChecked(!on);
|
2013-05-13 21:24:19 +02:00
|
|
|
}
|
2012-05-24 23:48:58 +02:00
|
|
|
}
|
2011-03-13 15:14:52 +01:00
|
|
|
|
2012-05-24 23:48:58 +02:00
|
|
|
connect(this, SIGNAL(legendChecked(QwtPlotItem *, bool)), this, SLOT(showCurve(QwtPlotItem *, bool)));
|
2011-02-14 11:19:18 +01:00
|
|
|
}
|
|
|
|
|
2010-08-10 07:42:39 +02:00
|
|
|
void ScopeGadgetWidget::preparePlot(PlotType plotType)
|
|
|
|
{
|
|
|
|
m_plotType = plotType;
|
|
|
|
|
|
|
|
clearCurvePlots();
|
|
|
|
|
|
|
|
setMinimumSize(64, 64);
|
|
|
|
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
2011-02-13 22:04:31 +01:00
|
|
|
|
2012-05-24 23:48:58 +02:00
|
|
|
setCanvasBackground(QColor(64, 64, 64));
|
2010-08-14 22:25:55 +02:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
// Add grid lines
|
2010-08-14 22:25:55 +02:00
|
|
|
QwtPlotGrid *grid = new QwtPlotGrid;
|
2012-05-24 23:48:58 +02:00
|
|
|
grid->setMajPen(QPen(Qt::gray, 0, Qt::DashLine));
|
|
|
|
grid->setMinPen(QPen(Qt::lightGray, 0, Qt::DotLine));
|
|
|
|
grid->setPen(QPen(Qt::darkGray, 1, Qt::DotLine));
|
|
|
|
grid->attach(this);
|
2010-08-10 07:42:39 +02:00
|
|
|
|
2011-01-20 23:30:49 +01:00
|
|
|
// Only start the timer if we are already connected
|
|
|
|
Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager();
|
2014-07-14 22:09:53 +02:00
|
|
|
if (cm->isConnected() && replotTimer) {
|
2013-05-13 21:24:19 +02:00
|
|
|
if (!replotTimer->isActive()) {
|
2012-05-24 23:48:58 +02:00
|
|
|
replotTimer->start(m_refreshInterval);
|
2013-05-13 21:24:19 +02:00
|
|
|
} else {
|
2012-05-24 23:48:58 +02:00
|
|
|
replotTimer->setInterval(m_refreshInterval);
|
2013-05-13 21:24:19 +02:00
|
|
|
}
|
2012-05-24 23:48:58 +02:00
|
|
|
}
|
2010-08-10 07:42:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScopeGadgetWidget::showCurve(QwtPlotItem *item, bool on)
|
|
|
|
{
|
|
|
|
item->setVisible(!on);
|
2014-01-26 16:54:24 +01:00
|
|
|
if (legend()) {
|
|
|
|
QWidget *w = legend()->find(item);
|
|
|
|
if (w && w->inherits("QwtLegendItem")) {
|
|
|
|
((QwtLegendItem *)w)->setChecked(on);
|
|
|
|
}
|
2013-05-13 21:24:19 +02:00
|
|
|
}
|
2010-08-10 07:42:39 +02:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
mutex.lock();
|
|
|
|
replot();
|
|
|
|
mutex.unlock();
|
2010-08-10 07:42:39 +02:00
|
|
|
}
|
|
|
|
|
2012-05-21 23:34:29 +02:00
|
|
|
void ScopeGadgetWidget::setupSequentialPlot()
|
2010-08-10 07:42:39 +02:00
|
|
|
{
|
2012-05-21 23:34:29 +02:00
|
|
|
preparePlot(SequentialPlot);
|
2010-08-10 07:42:39 +02:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
// QwtText title("Index");
|
2011-02-13 22:04:31 +01:00
|
|
|
//// title.setFont(QFont("Helvetica", 20));
|
2013-05-13 21:24:19 +02:00
|
|
|
// title.font().setPointSize(title.font().pointSize() / 2);
|
|
|
|
// setAxisTitle(QwtPlot::xBottom, title);
|
2011-02-13 22:04:31 +01:00
|
|
|
//// setAxisTitle(QwtPlot::xBottom, "Index");
|
|
|
|
|
2010-08-10 07:42:39 +02:00
|
|
|
setAxisScaleDraw(QwtPlot::xBottom, new QwtScaleDraw());
|
2014-10-22 00:52:39 +02:00
|
|
|
setAxisScale(QwtPlot::xBottom, 0, m_plotDataSize);
|
2010-08-10 07:42:39 +02:00
|
|
|
setAxisLabelRotation(QwtPlot::xBottom, 0.0);
|
|
|
|
setAxisLabelAlignment(QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom);
|
2011-02-14 01:44:33 +01:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
QwtScaleWidget *scaleWidget = axisWidget(QwtPlot::xBottom);
|
2011-02-14 01:44:33 +01:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
// reduce the gap between the scope canvas and the axis scale
|
|
|
|
scaleWidget->setMargin(0);
|
2011-02-14 01:44:33 +01:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
// reduce the axis font size
|
|
|
|
QFont fnt(axisFont(QwtPlot::xBottom));
|
|
|
|
fnt.setPointSize(7);
|
|
|
|
setAxisFont(QwtPlot::xBottom, fnt); // x-axis
|
|
|
|
setAxisFont(QwtPlot::yLeft, fnt); // y-axis
|
2010-08-10 07:42:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScopeGadgetWidget::setupChronoPlot()
|
|
|
|
{
|
|
|
|
preparePlot(ChronoPlot);
|
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
// QwtText title("Time [h:m:s]");
|
2011-02-13 22:04:31 +01:00
|
|
|
//// title.setFont(QFont("Helvetica", 20));
|
2013-05-13 21:24:19 +02:00
|
|
|
// title.font().setPointSize(title.font().pointSize() / 2);
|
|
|
|
// setAxisTitle(QwtPlot::xBottom, title);
|
2011-02-13 22:04:31 +01:00
|
|
|
//// setAxisTitle(QwtPlot::xBottom, "Time [h:m:s]");
|
|
|
|
|
2010-08-10 07:42:39 +02:00
|
|
|
setAxisScaleDraw(QwtPlot::xBottom, new TimeScaleDraw());
|
|
|
|
uint NOW = QDateTime::currentDateTime().toTime_t();
|
2014-10-22 00:52:39 +02:00
|
|
|
setAxisScale(QwtPlot::xBottom, NOW - m_plotDataSize / 1000, NOW);
|
2013-05-13 21:24:19 +02:00
|
|
|
// setAxisLabelRotation(QwtPlot::xBottom, -15.0);
|
|
|
|
setAxisLabelRotation(QwtPlot::xBottom, 0.0);
|
|
|
|
setAxisLabelAlignment(QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom);
|
|
|
|
// setAxisLabelAlignment(QwtPlot::xBottom, Qt::AlignCenter | Qt::AlignBottom);
|
|
|
|
|
|
|
|
QwtScaleWidget *scaleWidget = axisWidget(QwtPlot::xBottom);
|
|
|
|
// QwtScaleDraw *scaleDraw = axisScaleDraw();
|
|
|
|
|
|
|
|
// reduce the gap between the scope canvas and the axis scale
|
|
|
|
scaleWidget->setMargin(0);
|
|
|
|
|
|
|
|
// reduce the axis font size
|
|
|
|
QFont fnt(axisFont(QwtPlot::xBottom));
|
|
|
|
fnt.setPointSize(7);
|
|
|
|
setAxisFont(QwtPlot::xBottom, fnt); // x-axis
|
|
|
|
setAxisFont(QwtPlot::yLeft, fnt); // y-axis
|
|
|
|
|
|
|
|
// set the axis colours .. can't seem to change the background colour :(
|
|
|
|
// QPalette pal = scaleWidget->palette();
|
|
|
|
// QPalette::ColorRole cr = scaleWidget->backgroundRole();
|
|
|
|
// pal.setColor(cr, QColor(128, 128, 128)); // background colour
|
|
|
|
// cr = scaleWidget->foregroundRole();
|
|
|
|
// pal.setColor(cr, QColor(255, 255, 255)); // tick colour
|
|
|
|
// pal.setColor(QPalette::Text, QColor(255, 255, 255)); // text colour
|
|
|
|
// scaleWidget->setPalette(pal);
|
2011-02-13 22:04:31 +01:00
|
|
|
|
2010-08-10 07:42:39 +02:00
|
|
|
/*
|
2013-05-13 21:24:19 +02:00
|
|
|
In situations, when there is a label at the most right position of the
|
|
|
|
scale, additional space is needed to display the overlapping part
|
|
|
|
of the label would be taken by reducing the width of scale and canvas.
|
|
|
|
To avoid this "jumping canvas" effect, we add a permanent margin.
|
|
|
|
We don't need to do the same for the left border, because there
|
|
|
|
is enough space for the overlapping label below the left scale.
|
2010-08-10 07:42:39 +02:00
|
|
|
*/
|
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
// const int fmh = QFontMetrics(scaleWidget->font()).height();
|
|
|
|
// scaleWidget->setMinBorderDist(0, fmh / 2);
|
2011-02-14 01:44:33 +01:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
// const int fmw = QFontMetrics(scaleWidget->font()).width(" 00:00:00 ");
|
|
|
|
// const int fmw = QFontMetrics(scaleWidget->font()).width(" ");
|
|
|
|
// scaleWidget->setMinBorderDist(0, fmw);
|
2010-08-10 07:42:39 +02:00
|
|
|
}
|
|
|
|
|
2014-10-22 00:52:39 +02:00
|
|
|
void ScopeGadgetWidget::addCurvePlot(QString objectName, QString fieldPlusSubField, int scaleFactor, int meanSamples, QString mathFunction, QPen pen, bool antialiased)
|
2010-08-10 07:42:39 +02:00
|
|
|
{
|
2014-10-22 00:52:39 +02:00
|
|
|
QString fieldName = fieldPlusSubField;
|
|
|
|
QString elementName;
|
|
|
|
if (fieldPlusSubField.contains("-")) {
|
|
|
|
QStringList fieldSubfield = fieldName.split("-", QString::SkipEmptyParts);
|
|
|
|
fieldName = fieldSubfield.at(0);
|
|
|
|
elementName = fieldSubfield.at(1);
|
2013-05-13 21:24:19 +02:00
|
|
|
}
|
2010-08-10 07:42:39 +02:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
// Create the curve
|
2014-10-22 00:52:39 +02:00
|
|
|
QString curveName = objectName + "." + fieldName;
|
|
|
|
if (!elementName.isEmpty()) {
|
|
|
|
curveName.append("." + elementName);
|
2013-05-13 21:24:19 +02:00
|
|
|
}
|
2010-08-30 16:17:15 +02:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
// Get the uav object
|
2010-09-01 23:29:24 +02:00
|
|
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
|
|
|
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
2014-10-22 00:52:39 +02:00
|
|
|
UAVDataObject *obj = dynamic_cast<UAVDataObject *>(objManager->getObject(objectName));
|
2013-05-13 21:24:19 +02:00
|
|
|
if (!obj) {
|
2014-10-22 00:52:39 +02:00
|
|
|
qDebug() << "Object " << objectName << " is missing";
|
2011-08-29 18:37:22 +02:00
|
|
|
return;
|
|
|
|
}
|
2014-10-22 00:52:39 +02:00
|
|
|
UAVObjectField *field = obj->getField(fieldName);
|
2013-05-13 21:24:19 +02:00
|
|
|
if (!field) {
|
2014-10-22 00:52:39 +02:00
|
|
|
qDebug() << "In scope gadget, in fields loaded from GCS config file, field" <<
|
|
|
|
fieldName << " of object " << objectName << " is missing";
|
2011-08-29 18:37:22 +02:00
|
|
|
return;
|
|
|
|
}
|
2010-09-01 23:29:24 +02:00
|
|
|
QString units = field->getUnits();
|
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
if (units == 0) {
|
2010-09-01 23:29:24 +02:00
|
|
|
units = QString();
|
2013-05-13 21:24:19 +02:00
|
|
|
}
|
2010-09-01 23:29:24 +02:00
|
|
|
|
2010-08-30 16:17:15 +02:00
|
|
|
QString curveNameScaled;
|
2014-10-22 00:52:39 +02:00
|
|
|
if (scaleFactor == 0) {
|
2013-03-02 14:18:52 +01:00
|
|
|
curveNameScaled = curveName + " (" + units + ")";
|
2013-05-13 21:24:19 +02:00
|
|
|
} else {
|
2014-10-22 00:52:39 +02:00
|
|
|
curveNameScaled = curveName + " (x10^" + QString::number(scaleFactor) + " " + units + ")";
|
2013-05-13 21:24:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
QwtPlotCurve *plotCurve = new QwtPlotCurve(curveNameScaled);
|
|
|
|
|
|
|
|
if (antialiased) {
|
|
|
|
plotCurve->setRenderHint(QwtPlotCurve::RenderAntialiased);
|
|
|
|
}
|
2010-08-30 00:45:12 +02:00
|
|
|
|
2010-08-10 07:42:39 +02:00
|
|
|
plotCurve->setPen(pen);
|
|
|
|
plotCurve->attach(this);
|
2014-10-22 00:52:39 +02:00
|
|
|
|
|
|
|
PlotData *plotData;
|
|
|
|
|
|
|
|
if (m_plotType == SequentialPlot) {
|
|
|
|
plotData = new SequentialPlotData(objectName, fieldName, elementName, plotCurve, scaleFactor,
|
|
|
|
meanSamples, mathFunction, m_plotDataSize);
|
|
|
|
} else if (m_plotType == ChronoPlot) {
|
|
|
|
plotData = new ChronoPlotData(objectName, fieldName, elementName, plotCurve, scaleFactor,
|
|
|
|
meanSamples, mathFunction, m_plotDataSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the y-bounds are supplied, set them
|
|
|
|
if (plotData->yMin() != plotData->yMax()) {
|
|
|
|
setAxisScale(QwtPlot::yLeft, plotData->yMin(), plotData->yMax());
|
|
|
|
}
|
2010-08-10 07:42:39 +02:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
// Keep the curve details for later
|
2010-08-30 16:17:15 +02:00
|
|
|
m_curvesData.insert(curveNameScaled, plotData);
|
2010-08-10 07:42:39 +02:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
// Link to the new signal data only if this UAVObject has not been connected yet
|
2010-08-10 07:42:39 +02:00
|
|
|
if (!m_connectedUAVObjects.contains(obj->getName())) {
|
|
|
|
m_connectedUAVObjects.append(obj->getName());
|
2013-05-13 21:24:19 +02:00
|
|
|
connect(obj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(uavObjectReceived(UAVObject *)));
|
2010-08-10 07:42:39 +02:00
|
|
|
}
|
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
mutex.lock();
|
|
|
|
replot();
|
|
|
|
mutex.unlock();
|
2010-08-10 07:42:39 +02:00
|
|
|
}
|
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
void ScopeGadgetWidget::uavObjectReceived(UAVObject *obj)
|
2010-08-10 07:42:39 +02:00
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
foreach(PlotData * plotData, m_curvesData.values()) {
|
|
|
|
if (plotData->append(obj)) {
|
|
|
|
m_csvLoggingDataUpdated = 1;
|
|
|
|
}
|
2010-08-10 07:42:39 +02:00
|
|
|
}
|
2011-11-26 22:51:20 +01:00
|
|
|
csvLoggingAddData();
|
2010-08-10 07:42:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScopeGadgetWidget::replotNewData()
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
if (!isVisible()) {
|
|
|
|
return;
|
|
|
|
}
|
2011-02-14 11:19:18 +01:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
QMutexLocker locker(&mutex);
|
|
|
|
foreach(PlotData * plotData, m_curvesData.values()) {
|
2010-08-14 22:25:55 +02:00
|
|
|
plotData->removeStaleData();
|
2014-10-22 00:52:39 +02:00
|
|
|
plotData->updatePlotCurveData();
|
2010-08-14 22:25:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
QDateTime NOW = QDateTime::currentDateTime();
|
|
|
|
double toTime = NOW.toTime_t();
|
|
|
|
toTime += NOW.time().msec() / 1000.0;
|
2013-05-13 21:24:19 +02:00
|
|
|
if (m_plotType == ChronoPlot) {
|
2014-10-22 00:52:39 +02:00
|
|
|
setAxisScale(QwtPlot::xBottom, toTime - m_plotDataSize, toTime);
|
2013-05-13 21:24:19 +02:00
|
|
|
}
|
2011-02-14 11:19:18 +01:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
// qDebug() << "replotNewData from " << NOW.addSecs(- m_xWindowSize) << " to " << NOW;
|
2011-02-14 11:19:18 +01:00
|
|
|
|
2011-01-31 03:09:44 +01:00
|
|
|
csvLoggingInsertData();
|
2010-08-10 07:42:39 +02:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
replot();
|
2010-08-10 07:42:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScopeGadgetWidget::clearCurvePlots()
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
foreach(PlotData * plotData, m_curvesData.values()) {
|
2010-08-10 07:42:39 +02:00
|
|
|
delete plotData;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_curvesData.clear();
|
|
|
|
}
|
|
|
|
|
2014-01-26 16:54:24 +01:00
|
|
|
void ScopeGadgetWidget::saveState(QSettings *qSettings)
|
|
|
|
{
|
2014-10-22 00:52:39 +02:00
|
|
|
/*
|
2014-01-26 16:54:24 +01:00
|
|
|
// plot state
|
|
|
|
int i = 1;
|
|
|
|
|
|
|
|
foreach(PlotData * plotData, m_curvesData.values()) {
|
2014-10-22 00:52:39 +02:00
|
|
|
bool plotVisible = plotData->isVisible();
|
2014-03-20 01:46:38 +01:00
|
|
|
|
2014-01-30 21:54:05 +01:00
|
|
|
if (!plotVisible) {
|
|
|
|
qSettings->setValue(QString("plot%1").arg(i), plotVisible);
|
|
|
|
}
|
2014-01-26 16:54:24 +01:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
// legend state
|
|
|
|
qSettings->setValue("legendVisible", legend() != NULL);
|
2014-10-22 00:52:39 +02:00
|
|
|
*/
|
2014-01-26 16:54:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScopeGadgetWidget::restoreState(QSettings *qSettings)
|
|
|
|
{
|
2014-10-22 00:52:39 +02:00
|
|
|
/*
|
2014-01-26 16:54:24 +01:00
|
|
|
// plot state
|
|
|
|
int i = 1;
|
|
|
|
|
|
|
|
foreach(PlotData * plotData, m_curvesData.values()) {
|
|
|
|
bool visible = qSettings->value(QString("plot%1").arg(i), true).toBool();
|
|
|
|
|
2014-10-22 00:52:39 +02:00
|
|
|
showCurve(plotData->m_plotCurve, !visible);
|
2014-01-26 16:54:24 +01:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
// legend state
|
|
|
|
bool legendVisible = qSettings->value("legendVisible", true).toBool();
|
|
|
|
if (legendVisible) {
|
|
|
|
addLegend();
|
|
|
|
} else {
|
|
|
|
deleteLegend();
|
|
|
|
}
|
2014-10-22 00:52:39 +02:00
|
|
|
*/
|
2014-01-26 16:54:24 +01:00
|
|
|
}
|
2010-08-14 22:25:55 +02:00
|
|
|
|
2011-01-31 03:09:44 +01:00
|
|
|
/*
|
2013-05-13 21:24:19 +02:00
|
|
|
int csvLoggingEnable;
|
|
|
|
int csvLoggingHeaderSaved;
|
|
|
|
int csvLoggingDataSaved;
|
|
|
|
QString csvLoggingPath;
|
|
|
|
QFile csvLoggingFile;
|
|
|
|
*/
|
2011-01-31 03:09:44 +01:00
|
|
|
int ScopeGadgetWidget::csvLoggingStart()
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
if (!m_csvLoggingStarted) {
|
|
|
|
if (m_csvLoggingEnabled) {
|
|
|
|
if ((!m_csvLoggingNewFileOnConnect) || (m_csvLoggingNewFileOnConnect && m_csvLoggingConnected)) {
|
|
|
|
QDateTime NOW = QDateTime::currentDateTime();
|
|
|
|
m_csvLoggingStartTime = NOW;
|
|
|
|
m_csvLoggingHeaderSaved = 0;
|
|
|
|
m_csvLoggingDataSaved = 0;
|
|
|
|
m_csvLoggingBuffer.clear();
|
|
|
|
QDir PathCheck(m_csvLoggingPath);
|
|
|
|
if (!PathCheck.exists()) {
|
|
|
|
PathCheck.mkpath("./");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (m_csvLoggingNameSet) {
|
|
|
|
m_csvLoggingFile.setFileName(QString("%1/%2_%3_%4.csv").arg(m_csvLoggingPath).arg(m_csvLoggingName).arg(NOW.toString("yyyy-MM-dd")).arg(NOW.toString("hh-mm-ss")));
|
|
|
|
} else {
|
|
|
|
m_csvLoggingFile.setFileName(QString("%1/Log_%2_%3.csv").arg(m_csvLoggingPath).arg(NOW.toString("yyyy-MM-dd")).arg(NOW.toString("hh-mm-ss")));
|
|
|
|
}
|
|
|
|
QDir FileCheck(m_csvLoggingFile.fileName());
|
|
|
|
if (FileCheck.exists()) {
|
|
|
|
m_csvLoggingFile.setFileName("");
|
|
|
|
} else {
|
|
|
|
m_csvLoggingStarted = 1;
|
|
|
|
csvLoggingInsertHeader();
|
|
|
|
}
|
|
|
|
}
|
2011-01-31 03:09:44 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ScopeGadgetWidget::csvLoggingStop()
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
m_csvLoggingStarted = 0;
|
2011-01-31 03:09:44 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ScopeGadgetWidget::csvLoggingInsertHeader()
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
if (!m_csvLoggingStarted) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (m_csvLoggingHeaderSaved) {
|
|
|
|
return -2;
|
|
|
|
}
|
|
|
|
if (m_csvLoggingDataSaved) {
|
|
|
|
return -3;
|
|
|
|
}
|
2011-01-31 03:09:44 +01:00
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
m_csvLoggingHeaderSaved = 1;
|
2013-09-15 23:06:25 +02:00
|
|
|
if (m_csvLoggingFile.open(QIODevice::WriteOnly | QIODevice::Append) == false) {
|
2011-01-31 03:09:44 +01:00
|
|
|
qDebug() << "Unable to open " << m_csvLoggingFile.fileName() << " for csv logging Header";
|
2013-05-13 21:24:19 +02:00
|
|
|
} else {
|
|
|
|
QTextStream ts(&m_csvLoggingFile);
|
|
|
|
ts << "date" << ", " << "Time" << ", " << "Sec since start" << ", " << "Connected" << ", " << "Data changed";
|
|
|
|
|
|
|
|
foreach(PlotData * plotData2, m_curvesData.values()) {
|
|
|
|
ts << ", ";
|
2014-10-22 00:52:39 +02:00
|
|
|
ts << plotData2->objectName();
|
|
|
|
ts << "." << plotData2->fieldName();
|
|
|
|
if (!plotData2->elementName().isEmpty()) {
|
|
|
|
ts << "." << plotData2->elementName();
|
2013-05-13 21:24:19 +02:00
|
|
|
}
|
2011-01-31 03:09:44 +01:00
|
|
|
}
|
|
|
|
ts << endl;
|
|
|
|
m_csvLoggingFile.close();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-11-26 22:51:20 +01:00
|
|
|
int ScopeGadgetWidget::csvLoggingAddData()
|
2011-01-31 03:09:44 +01:00
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
if (!m_csvLoggingStarted) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
m_csvLoggingDataValid = 0;
|
2011-01-31 03:09:44 +01:00
|
|
|
QDateTime NOW = QDateTime::currentDateTime();
|
|
|
|
QString tempString;
|
|
|
|
|
2013-05-13 21:24:19 +02:00
|
|
|
QTextStream ss(&tempString);
|
|
|
|
ss << NOW.toString("yyyy-MM-dd") << ", " << NOW.toString("hh:mm:ss.z") << ", ";
|
2011-02-01 18:43:30 +01:00
|
|
|
|
2011-02-01 15:57:39 +01:00
|
|
|
#if QT_VERSION >= 0x040700
|
2013-05-13 21:24:19 +02:00
|
|
|
ss << (NOW.toMSecsSinceEpoch() - m_csvLoggingStartTime.toMSecsSinceEpoch()) / 1000.00;
|
2011-02-01 15:57:39 +01:00
|
|
|
#else
|
2013-05-13 21:24:19 +02:00
|
|
|
ss << (NOW.toTime_t() - m_csvLoggingStartTime.toTime_t());
|
2011-02-01 15:57:39 +01:00
|
|
|
#endif
|
2011-11-26 22:51:20 +01:00
|
|
|
ss << ", " << m_csvLoggingConnected << ", " << m_csvLoggingDataUpdated;
|
2013-05-13 21:24:19 +02:00
|
|
|
m_csvLoggingDataUpdated = 0;
|
|
|
|
|
|
|
|
foreach(PlotData * plotData2, m_curvesData.values()) {
|
|
|
|
ss << ", ";
|
2014-10-22 00:52:39 +02:00
|
|
|
if (plotData2->xData.isEmpty()) {
|
2013-05-13 21:24:19 +02:00
|
|
|
ss << ", ";
|
2014-10-22 00:52:39 +02:00
|
|
|
if (plotData2->xData.isEmpty()) {} else {
|
|
|
|
ss << QString().sprintf("%3.10g", plotData2->yData.last());
|
2013-05-13 21:24:19 +02:00
|
|
|
m_csvLoggingDataValid = 1;
|
2011-01-31 03:09:44 +01:00
|
|
|
}
|
2013-05-13 21:24:19 +02:00
|
|
|
} else {
|
2014-10-22 00:52:39 +02:00
|
|
|
ss << QString().sprintf("%3.10g", plotData2->yData.last());
|
2013-05-13 21:24:19 +02:00
|
|
|
m_csvLoggingDataValid = 1;
|
2011-01-31 03:09:44 +01:00
|
|
|
}
|
|
|
|
}
|
2011-11-26 22:51:20 +01:00
|
|
|
ss << endl;
|
2013-05-13 21:24:19 +02:00
|
|
|
if (m_csvLoggingDataValid) {
|
|
|
|
QTextStream ts(&m_csvLoggingBuffer);
|
2011-11-26 22:51:20 +01:00
|
|
|
ts << tempString;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ScopeGadgetWidget::csvLoggingInsertData()
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
if (!m_csvLoggingStarted) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
m_csvLoggingDataSaved = 1;
|
2011-01-31 03:09:44 +01:00
|
|
|
|
2013-09-15 23:06:25 +02:00
|
|
|
if (m_csvLoggingFile.open(QIODevice::WriteOnly | QIODevice::Append) == false) {
|
2011-11-26 22:51:20 +01:00
|
|
|
qDebug() << "Unable to open " << m_csvLoggingFile.fileName() << " for csv logging Data";
|
2013-05-13 21:24:19 +02:00
|
|
|
} else {
|
|
|
|
QTextStream ts(&m_csvLoggingFile);
|
2011-11-26 22:51:20 +01:00
|
|
|
ts << m_csvLoggingBuffer;
|
|
|
|
m_csvLoggingFile.close();
|
|
|
|
}
|
|
|
|
m_csvLoggingBuffer.clear();
|
2011-01-31 03:09:44 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2011-02-14 11:19:18 +01:00
|
|
|
|
2011-01-31 03:09:44 +01:00
|
|
|
void ScopeGadgetWidget::csvLoggingSetName(QString newName)
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
m_csvLoggingName = newName;
|
|
|
|
m_csvLoggingNameSet = 1;
|
2011-01-31 03:09:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScopeGadgetWidget::csvLoggingConnect()
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
m_csvLoggingConnected = 1;
|
|
|
|
if (m_csvLoggingNewFileOnConnect) {
|
|
|
|
csvLoggingStart();
|
|
|
|
}
|
2011-01-31 03:09:44 +01:00
|
|
|
}
|
2014-01-26 16:54:24 +01:00
|
|
|
|
2011-01-31 03:09:44 +01:00
|
|
|
void ScopeGadgetWidget::csvLoggingDisconnect()
|
|
|
|
{
|
2013-05-13 21:24:19 +02:00
|
|
|
m_csvLoggingHeaderSaved = 0;
|
|
|
|
m_csvLoggingConnected = 0;
|
|
|
|
if (m_csvLoggingNewFileOnConnect) {
|
|
|
|
csvLoggingStop();
|
|
|
|
}
|
2011-01-31 03:09:44 +01:00
|
|
|
}
|