Solved. ( Sorry, bad arithmetic calculating elapsed time - it should have been working all along )
The cpuplot source was used pretty much as is, simply replacing the timer event handler with my own code that I called when I received the updated time-stamped data sample:
// Update X-axis time series labels for the amount of time that has passed since last update
double elapsedTimeIntervalSeconds = (structDataSample.timeStampMs - m_structDataSampleLast.timeStampMs) / 1000.0;
m_structDataSampleLast = structDataSample;
qDebug() << "Dbg: elapsedTimeIntervalSeconds = " << elapsedTimeIntervalSeconds << endl;
for ( int j = 0; j < HISTORY_BUFFER_LENGTH; j++ )
{
timeDataSeries[j] = timeDataSeries[j] + elapsedTimeIntervalSeconds;
}
// Update X-axis time series labels for the amount of time that has passed since last update
double elapsedTimeIntervalSeconds = (structDataSample.timeStampMs - m_structDataSampleLast.timeStampMs) / 1000.0;
m_structDataSampleLast = structDataSample;
qDebug() << "Dbg: elapsedTimeIntervalSeconds = " << elapsedTimeIntervalSeconds << endl;
for ( int j = 0; j < HISTORY_BUFFER_LENGTH; j++ )
{
timeDataSeries[j] = timeDataSeries[j] + elapsedTimeIntervalSeconds;
}
To copy to clipboard, switch view to plain text mode
Bookmarks