1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

Revert "GVS/Scope: Bugfix: Export all known data points into CSV not just one per screen redraw"

This reverts commit 2ce3365861e63a3e805bd25284d1b3b0a33430a0.
This commit is contained in:
James Cotton 2011-12-12 23:36:37 -06:00
parent 000373b421
commit 40e7bf5c59
2 changed files with 33 additions and 47 deletions

View File

@ -447,7 +447,6 @@ void ScopeGadgetWidget::uavObjectReceived(UAVObject* obj)
foreach(PlotData* plotData, m_curvesData.values()) {
if (plotData->append(obj)) m_csvLoggingDataUpdated=1;
}
csvLoggingAddData();
}
void ScopeGadgetWidget::replotNewData()
@ -611,7 +610,6 @@ int ScopeGadgetWidget::csvLoggingStart()
m_csvLoggingStartTime = NOW;
m_csvLoggingHeaderSaved=0;
m_csvLoggingDataSaved=0;
m_csvLoggingBuffer.clear();
QDir PathCheck(m_csvLoggingPath);
if (!PathCheck.exists())
{
@ -679,50 +677,13 @@ int ScopeGadgetWidget::csvLoggingInsertHeader()
return 0;
}
int ScopeGadgetWidget::csvLoggingAddData()
{
if (!m_csvLoggingStarted) return -1;
m_csvLoggingDataValid=0;
QDateTime NOW = QDateTime::currentDateTime();
QString tempString;
QTextStream ss( &tempString );
ss << NOW.toString("yyyy-MM-dd") << ", " << NOW.toString("hh:mm:ss.z") << ", " ;
#if QT_VERSION >= 0x040700
ss <<(NOW.toMSecsSinceEpoch() - m_csvLoggingStartTime.toMSecsSinceEpoch())/1000.00;
#else
ss <<(NOW.toTime_t() - m_csvLoggingStartTime.toTime_t());
#endif
ss << ", " << m_csvLoggingConnected << ", " << m_csvLoggingDataUpdated;
m_csvLoggingDataUpdated=0;
foreach(PlotData* plotData2, m_curvesData.values())
{
ss << ", ";
if (plotData2->xData->isEmpty ())
{
}
else
{
ss << QString().sprintf("%3.6g",plotData2->yDataHistory->last()/pow(10,plotData2->scalePower));
m_csvLoggingDataValid=1;
}
}
ss << endl;
if (m_csvLoggingDataValid)
{
QTextStream ts( &m_csvLoggingBuffer );
ts << tempString;
}
return 0;
}
int ScopeGadgetWidget::csvLoggingInsertData()
{
if (!m_csvLoggingStarted) return -1;
m_csvLoggingDataSaved=1;
m_csvLoggingDataValid=0;
QDateTime NOW = QDateTime::currentDateTime();
QString tempString;
if(m_csvLoggingFile.open(QIODevice::WriteOnly | QIODevice::Append)== FALSE)
{
@ -730,11 +691,38 @@ int ScopeGadgetWidget::csvLoggingInsertData()
}
else
{
QTextStream ts( &m_csvLoggingFile );
ts << m_csvLoggingBuffer;
QTextStream ss( &tempString );
ss << NOW.toString("yyyy-MM-dd") << ", " << NOW.toString("hh:mm:ss.z") << ", " ;
#if QT_VERSION >= 0x040700
ss <<(NOW.toMSecsSinceEpoch() - m_csvLoggingStartTime.toMSecsSinceEpoch())/1000.00;
#else
ss <<(NOW.toTime_t() - m_csvLoggingStartTime.toTime_t());
#endif
ss << ", " << m_csvLoggingConnected << ", " << m_csvLoggingDataUpdated;
m_csvLoggingDataUpdated=0;
foreach(PlotData* plotData2, m_curvesData.values())
{
ss << ", ";
if (plotData2->xData->isEmpty ())
{
}
else
{
ss << QString().sprintf("%3.6g",plotData2->yDataHistory->last()/pow(10,plotData2->scalePower));
m_csvLoggingDataValid=1;
}
}
ss << endl;
if (m_csvLoggingDataValid)
{
QTextStream ts( &m_csvLoggingFile );
ts << tempString;
}
m_csvLoggingFile.close();
}
m_csvLoggingBuffer.clear();
return 0;
}

View File

@ -166,13 +166,11 @@ private:
QString m_csvLoggingName;
QString m_csvLoggingPath;
QString m_csvLoggingBuffer;
QFile m_csvLoggingFile;
QMutex mutex;
int csvLoggingInsertHeader();
int csvLoggingAddData();
int csvLoggingInsertData();
void deleteLegend();