diff --git a/re/sniffer/snifferitem.cpp b/re/sniffer/snifferitem.cpp index 2597fd0..2f5f1a9 100644 --- a/re/sniffer/snifferitem.cpp +++ b/re/sniffer/snifferitem.cpp @@ -16,8 +16,8 @@ SnifferItem::SnifferItem(const CANFrame& pFrame, quint32 seq): mLastMarker = mMarker; mCurrent.len = pFrame.len; /* that's dirty */ - update(pFrame, seq); - update(pFrame, seq); + update(pFrame, seq, false); + update(pFrame, seq, false); } @@ -85,8 +85,12 @@ int SnifferItem::elapsed() const } //called when a new frame comes in that matches our same ID -void SnifferItem::update(const CANFrame& pFrame, quint32 timeSeq) +//timeSeq is stored so we can figure out the last time a specific byte was updated +//mute is used to specify whether to mask the byte against the notching filter +//in order to hide any updates of the notched bits. This is toggleable +void SnifferItem::update(const CANFrame& pFrame, quint32 timeSeq, bool mute) { + unsigned char maskedCurr, maskedData; //qDebug() << "update with ts: " << timeSeq; /* copy current to last */ mLast = mCurrent; @@ -95,7 +99,11 @@ void SnifferItem::update(const CANFrame& pFrame, quint32 timeSeq) /* copy new value */ for (int i = 0; i < 8; i++) { - if (mCurrent.data[i] != pFrame.data[i]) + maskedData = pFrame.data[i]; + if (mute) maskedData &= ~mNotch[i]; + maskedCurr = mCurrent.data[i]; + if (mute) maskedCurr &= ~mNotch[i]; + if (maskedCurr != maskedData) { mCurrent.data[i] = pFrame.data[i]; mCurrent.dataTimestamp[i] = timeSeq; diff --git a/re/sniffer/snifferitem.h b/re/sniffer/snifferitem.h index 39067de..b5961c9 100644 --- a/re/sniffer/snifferitem.h +++ b/re/sniffer/snifferitem.h @@ -32,7 +32,7 @@ public: quint32 getDataTimestamp(uchar i) const; dc dataChange(uchar) const; int elapsed() const; - void update(const CANFrame& pFrame, quint32 timeSeq); + void update(const CANFrame& pFrame, quint32 timeSeq, bool mute); void updateMarker(); void notch(bool); diff --git a/re/sniffer/sniffermodel.cpp b/re/sniffer/sniffermodel.cpp index dd1f977..c395782 100644 --- a/re/sniffer/sniffermodel.cpp +++ b/re/sniffer/sniffermodel.cpp @@ -284,14 +284,14 @@ void SnifferModel::update(CANConnection*, QVector& pFrames) /* add the frame */ beginInsertRows(QModelIndex(), index, index); mMap[frame.ID] = new SnifferItem(frame, mTimeSequence); - mMap[frame.ID]->update(frame, mTimeSequence); + mMap[frame.ID]->update(frame, mTimeSequence, mMuteNotched); endInsertRows(); emit idChange(frame.ID, true); } else //updateData - mMap[frame.ID]->update(frame, mTimeSequence); + mMap[frame.ID]->update(frame, mTimeSequence, mMuteNotched); } } diff --git a/re/sniffer/snifferwindow.cpp b/re/sniffer/snifferwindow.cpp index df4b154..5e6c9aa 100644 --- a/re/sniffer/snifferwindow.cpp +++ b/re/sniffer/snifferwindow.cpp @@ -129,7 +129,10 @@ void SnifferWindow::idChange(int pId, bool pAdd) QString text = QString("0x") + QString("%1").arg(pId, 3, 16, QLatin1Char('0')).toUpper(); item = new QListWidgetItem(text); item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); - item->setCheckState(mFilter ? Qt::Unchecked : Qt::Checked); + //item->setCheckState(mFilter ? Qt::Unchecked : Qt::Checked); + //always check new IDs now. Otherwise any that expire then come back will not be selected + //and that might be a bigger issue than defaulting them unselected. + item->setCheckState(Qt::Checked); ui->listWidget->addItem(item); mMap[pId] = item; }