A quick fix to make frames with less than 8 data bytes not show
garbage after their valid bytes
This commit is contained in:
+17
-10
@@ -131,7 +131,7 @@ FlowViewWindow::FlowViewWindow(const QVector<CANFrame> *frames, QWidget *parent)
|
|||||||
connect(ui->graphView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequestGraph(QPoint)));
|
connect(ui->graphView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequestGraph(QPoint)));
|
||||||
ui->flowView->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->flowView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(ui->flowView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequestFlow(QPoint)));
|
connect(ui->flowView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequestFlow(QPoint)));
|
||||||
connect(ui->flowView, SIGNAL(gridClicked(int,int)), this, SLOT(gotCellClick(int, int)));
|
connect(ui->flowView, SIGNAL(gridClicked(int,int)), this, SLOT(gotCellClick(int,int)));
|
||||||
|
|
||||||
// Prevent annoying accidental horizontal scrolling when filter list is populated with long interpreted message names
|
// Prevent annoying accidental horizontal scrolling when filter list is populated with long interpreted message names
|
||||||
ui->listFrameID->horizontalScrollBar()->setEnabled(false);
|
ui->listFrameID->horizontalScrollBar()->setEnabled(false);
|
||||||
@@ -336,7 +336,9 @@ void FlowViewWindow::gotCenterTimeID(int32_t ID, double timestamp)
|
|||||||
memcpy(refBytes, currBytes, 8);
|
memcpy(refBytes, currBytes, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(currBytes, frameCache.at(currentPosition).payload().data(), 8);
|
memset(currBytes, 0, 8); //first zero out all 8 bytes
|
||||||
|
|
||||||
|
memcpy(currBytes, frameCache.at(currentPosition).payload().data(), frameCache.at(currentPosition).payload().length());
|
||||||
|
|
||||||
updateDataView();
|
updateDataView();
|
||||||
}
|
}
|
||||||
@@ -516,7 +518,8 @@ void FlowViewWindow::updatedFrames(int numFrames)
|
|||||||
if (ui->cbLiveMode->checkState() == Qt::Checked)
|
if (ui->cbLiveMode->checkState() == Qt::Checked)
|
||||||
{
|
{
|
||||||
currentPosition = frameCache.count() - 1;
|
currentPosition = frameCache.count() - 1;
|
||||||
memcpy(currBytes, frameCache.at(currentPosition).payload(), 8);
|
memset(currBytes, 0, 8);
|
||||||
|
memcpy(currBytes, frameCache.at(currentPosition).payload().data(), frameCache.at(currentPosition).payload().length());
|
||||||
memcpy(refBytes, currBytes, 8);
|
memcpy(refBytes, currBytes, 8);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -563,8 +566,10 @@ void FlowViewWindow::createGraph(int byteNum)
|
|||||||
{
|
{
|
||||||
frame = &frameCache[j];
|
frame = &frameCache[j];
|
||||||
data = reinterpret_cast<const unsigned char *>(frame->payload().constData());
|
data = reinterpret_cast<const unsigned char *>(frame->payload().constData());
|
||||||
|
if (byteNum < frameCache[j].payload().length())
|
||||||
tempVal = data[byteNum];
|
tempVal = data[byteNum];
|
||||||
|
else
|
||||||
|
tempVal = 0;
|
||||||
|
|
||||||
if (graphByTime)
|
if (graphByTime)
|
||||||
{
|
{
|
||||||
@@ -652,7 +657,8 @@ void FlowViewWindow::changeID(QString newID)
|
|||||||
|
|
||||||
updateGraphLocation();
|
updateGraphLocation();
|
||||||
|
|
||||||
memcpy(currBytes, frameCache.at(currentPosition).payload().constData(), 8);
|
memset(currBytes, 0, 8);
|
||||||
|
memcpy(currBytes, frameCache.at(currentPosition).payload().constData(), frameCache.at(currentPosition).payload().length());
|
||||||
memcpy(refBytes, currBytes, 8);
|
memcpy(refBytes, currBytes, 8);
|
||||||
|
|
||||||
updateDataView();
|
updateDataView();
|
||||||
@@ -699,8 +705,8 @@ void FlowViewWindow::btnStopClick()
|
|||||||
playbackActive = false;
|
playbackActive = false;
|
||||||
currentPosition = 0;
|
currentPosition = 0;
|
||||||
|
|
||||||
|
memset(currBytes, 0, 8);
|
||||||
memcpy(currBytes, frameCache.at(currentPosition).payload().constData(), 8);
|
memcpy(currBytes, frameCache.at(currentPosition).payload().constData(), frameCache.at(currentPosition).payload().length());
|
||||||
memcpy(refBytes, currBytes, 8);
|
memcpy(refBytes, currBytes, 8);
|
||||||
|
|
||||||
updateFrameLabel();
|
updateFrameLabel();
|
||||||
@@ -832,7 +838,7 @@ void FlowViewWindow::updatePosition(bool forward)
|
|||||||
//get through that then they're changed and a trigger so we stop playback at this frame.
|
//get through that then they're changed and a trigger so we stop playback at this frame.
|
||||||
uint64_t changedBits = 0;
|
uint64_t changedBits = 0;
|
||||||
uint8_t cngByte;
|
uint8_t cngByte;
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < frameCache.at(currentPosition).payload().length(); i++)
|
||||||
{
|
{
|
||||||
unsigned char thisByte = static_cast<unsigned char>(frameCache.at(currentPosition).payload().data()[i]);
|
unsigned char thisByte = static_cast<unsigned char>(frameCache.at(currentPosition).payload().data()[i]);
|
||||||
cngByte = currBytes[i] ^ thisByte;
|
cngByte = currBytes[i] ^ thisByte;
|
||||||
@@ -849,7 +855,8 @@ void FlowViewWindow::updatePosition(bool forward)
|
|||||||
playbackTimer->stop();
|
playbackTimer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(currBytes, frameCache.at(currentPosition).payload().constData(), 8);
|
memset(currBytes, 0, 8);
|
||||||
|
memcpy(currBytes, frameCache.at(currentPosition).payload().constData(), frameCache.at(currentPosition).payload().length());
|
||||||
|
|
||||||
if (ui->cbSync->checkState() == Qt::Checked) emit sendCenterTimeID(frameCache[currentPosition].frameId(), frameCache[currentPosition].timeStamp().microSeconds() / 1000000.0);
|
if (ui->cbSync->checkState() == Qt::Checked) emit sendCenterTimeID(frameCache[currentPosition].frameId(), frameCache[currentPosition].timeStamp().microSeconds() / 1000000.0);
|
||||||
ui->timelineSlider->setValue(currentPosition);
|
ui->timelineSlider->setValue(currentPosition);
|
||||||
|
|||||||
Reference in New Issue
Block a user