Removed singlewire mode from settings screen because it is on
connection screen now. Added ability to show binary view of a byte. Added changed bits to each message ID in the frame details view.
This commit is contained in:
+18
-1
@@ -113,6 +113,8 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
|
||||
int maxData[8];
|
||||
int dataHistogram[256][8];
|
||||
int bitfieldHistogram[64];
|
||||
uint8_t changedBits[8];
|
||||
uint8_t referenceBits[8];
|
||||
QTreeWidgetItem *baseNode, *dataBase, *histBase, *tempItem;
|
||||
|
||||
targettedID = Utility::ParseStringToNum(newID);
|
||||
@@ -196,6 +198,13 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
|
||||
}
|
||||
for (int j = 0; j < 64; j++) bitfieldHistogram[j] = 0;
|
||||
|
||||
for (int c = 0; c < 8; c++)
|
||||
{
|
||||
changedBits[c] = 0;
|
||||
referenceBits[c] = frameCache.at(0).data[c];
|
||||
qDebug() << referenceBits[c];
|
||||
}
|
||||
|
||||
//then find all data points
|
||||
for (int j = 0; j < frameCache.count(); j++)
|
||||
{
|
||||
@@ -217,6 +226,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
|
||||
bitfieldHistogram[c * 8 + l]++;
|
||||
}
|
||||
}
|
||||
changedBits[c] |= referenceBits[c] ^ dat;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,6 +252,13 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
|
||||
|
||||
dataBase->setText(0, tr("Data Byte ") + QString::number(c));
|
||||
baseNode->addChild(dataBase);
|
||||
|
||||
tempItem = new QTreeWidgetItem();
|
||||
QString builder;
|
||||
builder = tr("Changed bits: 0x") + QString::number(changedBits[c], 16) + " (" + Utility::formatByteAsBinary(changedBits[c]) + ")";
|
||||
tempItem->setText(0, builder);
|
||||
dataBase->addChild(tempItem);
|
||||
|
||||
tempItem = new QTreeWidgetItem();
|
||||
tempItem->setText(0, tr("Range: ") + Utility::formatNumber(minData[c]) + tr(" to ") + Utility::formatNumber(maxData[c]));
|
||||
dataBase->addChild(tempItem);
|
||||
@@ -253,7 +270,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
|
||||
if (dataHistogram[d][c] > 0)
|
||||
{
|
||||
tempItem = new QTreeWidgetItem();
|
||||
tempItem->setText(0, QString::number(d) + "/0x" + QString::number(d, 16) +": " + QString::number(dataHistogram[d][c]));
|
||||
tempItem->setText(0, QString::number(d) + "/0x" + QString::number(d, 16) +" (" + Utility::formatByteAsBinary(d) +") -> " + QString::number(dataHistogram[d][c]));
|
||||
histBase->addChild(tempItem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
||||
ui->cbTimeSeconds->setChecked(settings->value("Main/TimeSeconds", false).toBool());
|
||||
ui->comboSendingBus->setCurrentIndex(settings->value("Playback/SendingBus", 4).toInt());
|
||||
ui->cbUseFiltered->setChecked(settings->value("Main/UseFiltered", false).toBool());
|
||||
ui->cbSingleWire->setChecked(settings->value("Main/SingleWireMode", false).toBool());
|
||||
|
||||
//just for simplicity they all call the same function and that function updates all settings at once
|
||||
connect(ui->cbDisplayHex, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
@@ -44,7 +43,6 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
||||
connect(ui->cbTimeSeconds, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
connect(ui->comboSendingBus, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSettings()));
|
||||
connect(ui->cbUseFiltered, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
connect(ui->cbSingleWire, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||
}
|
||||
|
||||
MainSettingsDialog::~MainSettingsDialog()
|
||||
@@ -73,7 +71,6 @@ void MainSettingsDialog::updateSettings()
|
||||
settings->setValue("Main/TimeSeconds", ui->cbTimeSeconds->isChecked());
|
||||
settings->setValue("Playback/SendingBus", ui->comboSendingBus->currentIndex());
|
||||
settings->setValue("Main/UseFiltered", ui->cbUseFiltered->isChecked());
|
||||
settings->setValue("Main/SingleWireMode", ui->cbSingleWire->isChecked());
|
||||
|
||||
settings->sync();
|
||||
}
|
||||
|
||||
@@ -55,13 +55,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbSingleWire">
|
||||
<property name="text">
|
||||
<string>Put second canbus in single wire mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -73,6 +73,17 @@ public:
|
||||
else return formatHexNum(value);
|
||||
}
|
||||
|
||||
static QString formatByteAsBinary(uint8_t value)
|
||||
{
|
||||
QString output;
|
||||
for (int b = 7; b >= 0; b--)
|
||||
{
|
||||
if (value & (1 << b)) output += "1";
|
||||
else output += "0";
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
//parses the input string to grab as much of it as possible while staying alpha numeric
|
||||
static QString grabAlphaNumeric(QString &input)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user