Fix UDS interpretation of read by ID, Fix up display issues with

interpreted messages on main screen.
This commit is contained in:
Collin Kidder
2020-09-21 22:04:28 -04:00
parent 3fa9f14651
commit 18e20a2ee2
4 changed files with 20 additions and 11 deletions
+5 -5
View File
@@ -512,13 +512,13 @@ QString UDS_HANDLER::getDetailedMessageAnalysis(const UDS_MESSAGE &msg)
if (dataLen > 3) if (dataLen > 3)
{ {
int routineID; int routineID;
routineID = (data[1] * 256 + data[2]); routineID = (data[2] * 256 + data[3]);
buildString.append("\nRoutine ID: " + Utility::formatHexNum(routineID)); buildString.append("\nRoutine ID: " + Utility::formatHexNum(routineID));
} }
if (dataLen > 4) if (dataLen > 4)
{ {
buildString.append("\nParameter bytes to routine: "); buildString.append("\nParameter bytes to routine: ");
for (int i = 3; i < dataLen; i++) for (int i = 4; i < dataLen; i++)
{ {
buildString.append(Utility::formatHexNum(data[i]) + " "); buildString.append(Utility::formatHexNum(data[i]) + " ");
} }
@@ -529,13 +529,13 @@ QString UDS_HANDLER::getDetailedMessageAnalysis(const UDS_MESSAGE &msg)
if (dataLen > 2) if (dataLen > 2)
{ {
int routineID; int routineID;
routineID = (data[1] * 256 + data[2]); routineID = (data[2] * 256 + data[3]);
buildString.append("\nRoutine ID: " + Utility::formatHexNum(routineID)); buildString.append("\nRoutine ID: " + Utility::formatHexNum(routineID));
} }
if (dataLen > 3) if (dataLen > 4)
{ {
buildString.append("\nBytes returned by routine: "); buildString.append("\nBytes returned by routine: ");
for (int i = 3; i < dataLen; i++) for (int i = 4; i < dataLen; i++)
{ {
buildString.append(Utility::formatHexNum(data[i]) + " "); buildString.append(Utility::formatHexNum(data[i]) + " ");
} }
+2 -2
View File
@@ -463,8 +463,8 @@ QVariant CANFrameModel::data(const QModelIndex &index, int role) const
DBC_MESSAGE *msg = dbcHandler->findMessage(thisFrame); DBC_MESSAGE *msg = dbcHandler->findMessage(thisFrame);
if (msg != nullptr) if (msg != nullptr)
{ {
tempString.append(" <Interpreted>\n"); tempString.append(" <" + msg->name + ">\n");
tempString.append(msg->name + "\n" + msg->comment + "\n"); if (msg->comment.length() > 1) tempString.append(msg->comment + "\n");
for (int j = 0; j < msg->sigHandler->getCount(); j++) for (int j = 0; j < msg->sigHandler->getCount(); j++)
{ {
QString sigString; QString sigString;
+4 -1
View File
@@ -55,8 +55,11 @@ QListWidgetItem * FilterUtility::createFilterItem(int32_t id, QListWidget* paren
QListWidgetItem *thisItem = new QListWidgetItem(parent); QListWidgetItem *thisItem = new QListWidgetItem(parent);
QString filterItemName = Utility::formatCANID(id); QString filterItemName = Utility::formatCANID(id);
//Note, there are multiple filter labeling preferences. There is one in main settings to globally
//enable or disable them all. Then each loaded DBC file also can be selected on/off
//Both must be enabled for you to see labeling.
if (settings.value("Main/FilterLabeling", false).toBool()) if (settings.value("Main/FilterLabeling", false).toBool())
{ {
// Filter labeling (show interpreted frame names next to the CAN addr ID) // Filter labeling (show interpreted frame names next to the CAN addr ID)
MatchingCriteria_t matchingCriteria; MatchingCriteria_t matchingCriteria;
DBC_MESSAGE *msg = dbcHandler->findMessageForFilter(id,&matchingCriteria); DBC_MESSAGE *msg = dbcHandler->findMessageForFilter(id,&matchingCriteria);
+9 -3
View File
@@ -51,9 +51,15 @@ MainWindow::MainWindow(QWidget *parent) :
readSettings(); readSettings();
//QHeaderView *verticalHeader = ui->canFramesView->verticalHeader(); QHeaderView *verticalHeader = ui->canFramesView->verticalHeader();
//verticalHeader->setSectionResizeMode(QHeaderView::Fixed); verticalHeader->setSectionResizeMode(QHeaderView::Fixed);
//verticalHeader->setDefaultSectionSize(10); QSettings settings;
int fontSize = settings.value("Main/FontSize", 9).toUInt();
QFont sysFont = QFont(); //get default font
sysFont.setPointSize(fontSize);
verticalHeader->setDefaultSectionSize(sysFont.pixelSize());
ui->canFramesView->setFont(sysFont);
QHeaderView *HorzHdr = ui->canFramesView->horizontalHeader(); QHeaderView *HorzHdr = ui->canFramesView->horizontalHeader();
HorzHdr->setStretchLastSection(true); //causes the data column to automatically fill the tableview HorzHdr->setStretchLastSection(true); //causes the data column to automatically fill the tableview
connect(HorzHdr, SIGNAL(sectionClicked(int)), this, SLOT(headerClicked(int))); connect(HorzHdr, SIGNAL(sectionClicked(int)), this, SLOT(headerClicked(int)));