Addition of time normalization. Will reset the timing to start at zero and work up from there.
This commit is contained in:
@@ -17,6 +17,7 @@ CANFrameModel::CANFrameModel(QObject *parent)
|
|||||||
dbcHandler = NULL;
|
dbcHandler = NULL;
|
||||||
interpretFrames = false;
|
interpretFrames = false;
|
||||||
overwriteDups = false;
|
overwriteDups = false;
|
||||||
|
timeOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CANFrameModel::setDBCHandler(DBCHandler *handler)
|
void CANFrameModel::setDBCHandler(DBCHandler *handler)
|
||||||
@@ -36,6 +37,18 @@ void CANFrameModel::setInterpetMode(bool mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CANFrameModel::normalizeTiming()
|
||||||
|
{
|
||||||
|
if (frames.count() == 0) return;
|
||||||
|
this->beginResetModel();
|
||||||
|
timeOffset = frames[0].timestamp;
|
||||||
|
for (int i = 0; i < frames.count(); i++)
|
||||||
|
{
|
||||||
|
frames[i].timestamp -= timeOffset;
|
||||||
|
}
|
||||||
|
this->endResetModel();
|
||||||
|
}
|
||||||
|
|
||||||
void CANFrameModel::setOverwriteMode(bool mode)
|
void CANFrameModel::setOverwriteMode(bool mode)
|
||||||
{
|
{
|
||||||
overwriteDups = mode;
|
overwriteDups = mode;
|
||||||
@@ -140,6 +153,7 @@ void CANFrameModel::addFrame(CANFrame &frame, bool autoRefresh = false)
|
|||||||
{
|
{
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
if (autoRefresh) beginInsertRows(QModelIndex(), frames.count() + 1, frames.count() + 1);
|
if (autoRefresh) beginInsertRows(QModelIndex(), frames.count() + 1, frames.count() + 1);
|
||||||
|
frame.timestamp -= timeOffset;
|
||||||
frames.append(frame);
|
frames.append(frame);
|
||||||
if (autoRefresh) endInsertRows();
|
if (autoRefresh) endInsertRows();
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public:
|
|||||||
void setDBCHandler(DBCHandler *);
|
void setDBCHandler(DBCHandler *);
|
||||||
void setInterpetMode(bool);
|
void setInterpetMode(bool);
|
||||||
void setOverwriteMode(bool);
|
void setOverwriteMode(bool);
|
||||||
|
void normalizeTiming();
|
||||||
QVector<CANFrame> *getListReference();
|
QVector<CANFrame> *getListReference();
|
||||||
|
|
||||||
|
|
||||||
@@ -38,6 +39,7 @@ private:
|
|||||||
QMutex mutex;
|
QMutex mutex;
|
||||||
bool interpretFrames; //should we use the dbcHandler?
|
bool interpretFrames; //should we use the dbcHandler?
|
||||||
bool overwriteDups; //should we display all frames or only the newest for each ID?
|
bool overwriteDups; //should we display all frames or only the newest for each ID?
|
||||||
|
uint64_t timeOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
connect(ui->actionSave_Decoded_Frames, SIGNAL(triggered(bool)), this, SLOT(handleSaveDecoded()));
|
connect(ui->actionSave_Decoded_Frames, SIGNAL(triggered(bool)), this, SLOT(handleSaveDecoded()));
|
||||||
connect(ui->actionSingle_Multi_State, SIGNAL(triggered(bool)), this, SLOT(showSingleMultiWindow()));
|
connect(ui->actionSingle_Multi_State, SIGNAL(triggered(bool)), this, SLOT(showSingleMultiWindow()));
|
||||||
connect(ui->actionFile_Comparison, SIGNAL(triggered(bool)), this, SLOT(showComparisonWindow()));
|
connect(ui->actionFile_Comparison, SIGNAL(triggered(bool)), this, SLOT(showComparisonWindow()));
|
||||||
|
connect(ui->btnNormalize, SIGNAL(clicked(bool)), this, SLOT(normalizeTiming()));
|
||||||
|
|
||||||
lbStatusConnected.setText(tr("Not connected"));
|
lbStatusConnected.setText(tr("Not connected"));
|
||||||
updateFileStatus();
|
updateFileStatus();
|
||||||
@@ -268,6 +269,11 @@ void MainWindow::clearFrames()
|
|||||||
emit framesUpdated(-1);
|
emit framesUpdated(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::normalizeTiming()
|
||||||
|
{
|
||||||
|
model->normalizeTiming();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::changeBaudRates()
|
void MainWindow::changeBaudRates()
|
||||||
{
|
{
|
||||||
int Speed1 = 0, Speed2 = 0;
|
int Speed1 = 0, Speed2 = 0;
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ private slots:
|
|||||||
void overwriteToggled(bool);
|
void overwriteToggled(bool);
|
||||||
void showDBCEditor();
|
void showDBCEditor();
|
||||||
void toggleCapture();
|
void toggleCapture();
|
||||||
|
void normalizeTiming();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void gotFrames(int, int);
|
void gotFrames(int, int);
|
||||||
|
|||||||
@@ -201,6 +201,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnNormalize">
|
||||||
|
<property name="text">
|
||||||
|
<string>Normalize Frame Timing</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="btnClearFrames">
|
<widget class="QPushButton" name="btnClearFrames">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|||||||
Reference in New Issue
Block a user