Fix for a variety of small issues with sniffer window.
This commit is contained in:
@@ -3,18 +3,21 @@
|
||||
#include "snifferitem.h"
|
||||
|
||||
|
||||
SnifferItem::SnifferItem(const CANFrame& pFrame):
|
||||
SnifferItem::SnifferItem(const CANFrame& pFrame, quint32 seq):
|
||||
mID(pFrame.ID)
|
||||
{
|
||||
for (int i = 0; i < 8; i++) {
|
||||
mNotch[i] =0;
|
||||
mMarker.data[i] = 0;
|
||||
mMarker.dataTimestamp[i] = 0;
|
||||
mCurrent.data[i] = pFrame.data[i];
|
||||
mCurrent.dataTimestamp[i] = seq;
|
||||
}
|
||||
mLastMarker = mMarker;
|
||||
mCurrent.len = pFrame.len;
|
||||
/* that's dirty */
|
||||
update(pFrame, 0);
|
||||
update(pFrame, 0);
|
||||
update(pFrame, seq);
|
||||
update(pFrame, seq);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +87,7 @@ int SnifferItem::elapsed() const
|
||||
//called when a new frame comes in that matches our same ID
|
||||
void SnifferItem::update(const CANFrame& pFrame, quint32 timeSeq)
|
||||
{
|
||||
//qDebug() << "update with ts: " << timeSeq;
|
||||
/* copy current to last */
|
||||
mLast = mCurrent;
|
||||
mLastTime = mCurrentTime;
|
||||
|
||||
@@ -23,7 +23,7 @@ enum dc
|
||||
class SnifferItem
|
||||
{
|
||||
public:
|
||||
explicit SnifferItem(const CANFrame& pFrame);
|
||||
explicit SnifferItem(const CANFrame& pFrame, quint32 seq);
|
||||
virtual ~SnifferItem();
|
||||
|
||||
quint64 getId() const;
|
||||
|
||||
@@ -68,8 +68,10 @@ QVariant SnifferModel::data(const QModelIndex &index, int role) const
|
||||
case Qt::ForegroundRole:
|
||||
{
|
||||
if (!mFadeInactive || col < 2) return QBrush(Qt::black);
|
||||
int v = (mTimeSequence - item->getDataTimestamp(col - 2)) * 20;
|
||||
if (v > 215) v = 215;
|
||||
int v = (mTimeSequence - item->getDataTimestamp(col - 2)) * 10;
|
||||
//qDebug() << "mTS: " << mTimeSequence << " gDT(" << (col - 2) << ") " << item->getDataTimestamp(col - 2);
|
||||
if (v > 225) v = 225;
|
||||
if (v < 0) v = 0;
|
||||
return QBrush(QColor(v,v,v,255));
|
||||
break;
|
||||
}
|
||||
@@ -281,7 +283,7 @@ void SnifferModel::update(CANConnection*, QVector<CANFrame>& pFrames)
|
||||
int index = std::distance(mMap.begin(), mMap.lowerBound(frame.ID));
|
||||
/* add the frame */
|
||||
beginInsertRows(QModelIndex(), index, index);
|
||||
mMap[frame.ID] = new SnifferItem(frame);
|
||||
mMap[frame.ID] = new SnifferItem(frame, mTimeSequence);
|
||||
mMap[frame.ID]->update(frame, mTimeSequence);
|
||||
endInsertRows();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user