Merge branch 'master' of github.com:collin80/SavvyCAN

This commit is contained in:
Collin Kidder
2026-01-13 19:25:42 -05:00
4 changed files with 34 additions and 41 deletions
+7 -8
View File
@@ -44,8 +44,8 @@ jobs:
steps: steps:
- name: Prepare macOS Environment - name: Prepare macOS Environment
run: | run: |
brew install qt5 brew install qt@5
brew link qt5 --force brew link qt@5 --force
- name: Clone - name: Clone
uses: actions/checkout@v3 uses: actions/checkout@v3
@@ -74,8 +74,8 @@ jobs:
steps: steps:
- name: Prepare macOS Environment - name: Prepare macOS Environment
run: | run: |
brew install qt5 brew install qt@5
brew link qt5 --force brew link qt@5 --force
- name: Clone - name: Clone
uses: actions/checkout@v3 uses: actions/checkout@v3
@@ -99,7 +99,7 @@ jobs:
buildwindows: buildwindows:
name: Windows x64 name: Windows x64
runs-on: windows-2019 runs-on: windows-2022
steps: steps:
- name: Prepare Qt Libraries - name: Prepare Qt Libraries
@@ -111,8 +111,7 @@ jobs:
- name: Compile - name: Compile
shell: cmd shell: cmd
run: | run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
qmake CONFIG+=release SavvyCAN.pro qmake CONFIG+=release SavvyCAN.pro
nmake /C nmake /C
@@ -189,7 +188,7 @@ jobs:
release_msg="${release_msg//$'('/'-'}" release_msg="${release_msg//$'('/'-'}"
release_msg="${release_msg//$')'/'-'}" release_msg="${release_msg//$')'/'-'}"
echo $release_msg echo $release_msg
echo "::set-output name=msg::$release_msg" echo "{msg}={$release_msg}" >> $GITHUB_OUTPUT
- name: Notify Discord - name: Notify Discord
run: | run: |
+4 -4
View File
@@ -69,16 +69,16 @@ void CanLogServer::readNetworkData()
QString qstrId = lstMsg[0]; QString qstrId = lstMsg[0];
// Extract payload // Extract payload
QString qstrPayload = lstMsg[1]; QString qstrPayload = lstMsg[1];
// Support only normal can message. Extended CAN not supported. // Check ID size
if(qstrId.size() <= 4){ if(qstrId.size() <= 4 || qstrId.size() == 8){
// Prepare the frame // Prepare the frame
CANFrame* frame_p = getQueue().get(); CANFrame* frame_p = getQueue().get();
// Check for frame existence // Check for frame existence
if(frame_p){ if(frame_p){
// Set frame ID // Set frame ID
frame_p->setFrameId(qstrId.toInt(nullptr, 16)); frame_p->setFrameId(qstrId.toInt(nullptr, 16));
// Extended frame NOT SUPPORTED // Extended frame
frame_p->setExtendedFrameFormat(0); frame_p->setExtendedFrameFormat(frame_p->frameId() > 0x7FF);
// Set bus id // Set bus id
frame_p->bus = qstrCanId.toInt(); frame_p->bus = qstrCanId.toInt();
// Set frame type // Set frame type
+15 -13
View File
@@ -1131,8 +1131,7 @@ bool DBCFile::loadFile(QString fileName)
} }
//upon loading the file add our custom foreground and background color attributes if they don't exist already //upon loading the file add our custom foreground and background color attributes if they don't exist already
DBC_ATTRIBUTE *bgAttr = findAttributeByName("GenMsgBackgroundColor"); if (!findAttributeByName("GenMsgBackgroundColor"))
if (!bgAttr)
{ {
attr.attrType = ATTR_TYPE_MESSAGE; attr.attrType = ATTR_TYPE_MESSAGE;
attr.defaultValue = QApplication::palette().color(QPalette::Base).name(); attr.defaultValue = QApplication::palette().color(QPalette::Base).name();
@@ -1142,11 +1141,9 @@ bool DBCFile::loadFile(QString fileName)
attr.name = "GenMsgBackgroundColor"; attr.name = "GenMsgBackgroundColor";
attr.valType = ATTR_STRING; attr.valType = ATTR_STRING;
dbc_attributes.append(attr); dbc_attributes.append(attr);
bgAttr = findAttributeByName("GenMsgBackgroundColor");
} }
DBC_ATTRIBUTE *fgAttr = findAttributeByName("GenMsgForegroundColor"); if (!findAttributeByName("GenMsgForegroundColor"))
if (!fgAttr)
{ {
attr.attrType = ATTR_TYPE_MESSAGE; attr.attrType = ATTR_TYPE_MESSAGE;
attr.defaultValue = QApplication::palette().color(QPalette::WindowText).name(); attr.defaultValue = QApplication::palette().color(QPalette::WindowText).name();
@@ -1156,7 +1153,6 @@ bool DBCFile::loadFile(QString fileName)
attr.name = "GenMsgForegroundColor"; attr.name = "GenMsgForegroundColor";
attr.valType = ATTR_STRING; attr.valType = ATTR_STRING;
dbc_attributes.append(attr); dbc_attributes.append(attr);
fgAttr = findAttributeByName("GenMsgForegroundColor");
} }
DBC_ATTRIBUTE *mc_attr = findAttributeByName("matchingcriteria"); DBC_ATTRIBUTE *mc_attr = findAttributeByName("matchingcriteria");
@@ -1179,19 +1175,16 @@ bool DBCFile::loadFile(QString fileName)
messageHandler->setFilterLabeling(false); messageHandler->setFilterLabeling(false);
} }
QColor DefaultBG = QColor(bgAttr->defaultValue.toString()); QColor DefaultBG = QColor(findAttributeByName("GenMsgBackgroundColor")->defaultValue.toString());
QColor DefaultFG = QColor(fgAttr->defaultValue.toString()); QColor DefaultFG = QColor(findAttributeByName("GenMsgForegroundColor")->defaultValue.toString());
DBC_ATTRIBUTE_VALUE *thisBG;
DBC_ATTRIBUTE_VALUE *thisFG;
for (int x = 0; x < messageHandler->getCount(); x++) for (int x = 0; x < messageHandler->getCount(); x++)
{ {
DBC_MESSAGE *msg = messageHandler->findMsgByIdx(x); DBC_MESSAGE *msg = messageHandler->findMsgByIdx(x);
msg->bgColor = DefaultBG; msg->bgColor = DefaultBG;
msg->fgColor = DefaultFG; msg->fgColor = DefaultFG;
thisBG = msg->findAttrValByName("GenMsgBackgroundColor"); DBC_ATTRIBUTE_VALUE *thisBG = msg->findAttrValByName("GenMsgBackgroundColor");
thisFG = msg->findAttrValByName("GenMsgForegroundColor"); DBC_ATTRIBUTE_VALUE *thisFG = msg->findAttrValByName("GenMsgForegroundColor");
if (thisBG) msg->bgColor = QColor(thisBG->value.toString()); if (thisBG) msg->bgColor = QColor(thisBG->value.toString());
if (thisFG) msg->fgColor = QColor(thisFG->value.toString()); if (thisFG) msg->fgColor = QColor(thisFG->value.toString());
for (int y = 0; y < msg->sigHandler->getCount(); y++) for (int y = 0; y < msg->sigHandler->getCount(); y++)
@@ -1426,6 +1419,9 @@ bool DBCFile::saveFile(QString fileName)
case QVariant::Type::String: case QVariant::Type::String:
attrValOutput.append("\"" + val.value.toString() + "\";\n"); attrValOutput.append("\"" + val.value.toString() + "\";\n");
break; break;
case QVariant::Type::Bool:
attrValOutput.append(QString::number(val.value.toBool() ? 1 : 0) + ";\n");
break;
default: default:
attrValOutput.append(val.value.toString() + ";\n"); attrValOutput.append(val.value.toString() + ";\n");
break; break;
@@ -1471,6 +1467,9 @@ bool DBCFile::saveFile(QString fileName)
case QVariant::Type::String: case QVariant::Type::String:
attrValOutput.append("\"" + val.value.toString() + "\";\n"); attrValOutput.append("\"" + val.value.toString() + "\";\n");
break; break;
case QVariant::Type::Bool:
attrValOutput.append(QString::number(val.value.toBool() ? 1 : 0) + ";\n");
break;
default: default:
attrValOutput.append(val.value.toString() + ";\n"); attrValOutput.append(val.value.toString() + ";\n");
break; break;
@@ -1549,6 +1548,9 @@ bool DBCFile::saveFile(QString fileName)
case QVariant::Type::String: case QVariant::Type::String:
attrValOutput.append("\"" + val.value.toString() + "\";\n"); attrValOutput.append("\"" + val.value.toString() + "\";\n");
break; break;
case QVariant::Type::Bool:
attrValOutput.append(QString::number(val.value.toBool() ? 1 : 0) + ";\n");
break;
default: default:
attrValOutput.append(val.value.toString() + ";\n"); attrValOutput.append(val.value.toString() + ";\n");
break; break;
+8 -16
View File
@@ -1454,8 +1454,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
QByteArray bytes(numBytes, 0); QByteArray bytes(numBytes, 0);
thisFrame.isReceived = true; thisFrame.isReceived = true;
thisFrame.bus = 0; thisFrame.bus = 0;
if ((thisFrame.frameId() > 0x10000000) || if ((thisFrame.frameId() > 0x10000000) || (tokens[3].length() >= 8))
(tokens[3].length() >= 8))
{ {
thisFrame.setExtendedFrameFormat(true); thisFrame.setExtendedFrameFormat(true);
} }
@@ -1464,7 +1463,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
thisFrame.setExtendedFrameFormat(false); thisFrame.setExtendedFrameFormat(false);
} }
if (tokens[5] == "R") if (tokens.value(5) == "R") // might be empty!
{ {
thisFrame.setFrameType(QCanBusFrame::RemoteRequestFrame); thisFrame.setFrameType(QCanBusFrame::RemoteRequestFrame);
} }
@@ -1507,8 +1506,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
//qDebug() << thisFrame.payload().length(); //qDebug() << thisFrame.payload().length();
thisFrame.isReceived = true; thisFrame.isReceived = true;
thisFrame.bus = tokens[2].toInt(); thisFrame.bus = tokens[2].toInt();
if ((thisFrame.frameId() > 0x10000000) || if ((thisFrame.frameId() > 0x10000000) || (tokens[4].length() >= 8))
(tokens[4].length() >= 8))
{ {
thisFrame.setExtendedFrameFormat(true); thisFrame.setExtendedFrameFormat(true);
} }
@@ -1516,7 +1514,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
{ {
thisFrame.setExtendedFrameFormat(false); thisFrame.setExtendedFrameFormat(false);
} }
if (tokens[7] == "R") if (tokens.value(7) == "R")
{ {
thisFrame.setFrameType(QCanBusFrame::RemoteRequestFrame); thisFrame.setFrameType(QCanBusFrame::RemoteRequestFrame);
} }
@@ -1550,8 +1548,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
//qDebug() << thisFrame.payload().length(); //qDebug() << thisFrame.payload().length();
thisFrame.isReceived = true; thisFrame.isReceived = true;
thisFrame.bus = 0; thisFrame.bus = 0;
if ((thisFrame.frameId() > 0x10000000) || if ((thisFrame.frameId() > 0x10000000) || (tokens[3].length() >= 8))
(tokens[3].length() >= 8))
{ {
thisFrame.setExtendedFrameFormat(true); thisFrame.setExtendedFrameFormat(true);
} }
@@ -1559,7 +1556,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
{ {
thisFrame.setExtendedFrameFormat(false); thisFrame.setExtendedFrameFormat(false);
} }
if (tokens[6] == "R") if (tokens.value(6) == "R")
{ {
thisFrame.setFrameType(QCanBusFrame::RemoteRequestFrame); thisFrame.setFrameType(QCanBusFrame::RemoteRequestFrame);
} }
@@ -1603,8 +1600,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
//qDebug() << thisFrame.payload().length(); //qDebug() << thisFrame.payload().length();
thisFrame.isReceived = true; thisFrame.isReceived = true;
thisFrame.bus = tokens[3].toInt(); thisFrame.bus = tokens[3].toInt();
if ((thisFrame.frameId() > 0x10000000) || if ((thisFrame.frameId() > 0x10000000) || (tokens[4].length() >= 8))
(tokens[4].length() >= 8))
{ {
thisFrame.setExtendedFrameFormat(true); thisFrame.setExtendedFrameFormat(true);
} }
@@ -1646,10 +1642,7 @@ bool FrameFileIO::isCanalyzerASC(QString filename)
{ {
QFile *inFile = new QFile(filename); QFile *inFile = new QFile(filename);
QByteArray line; QByteArray line;
//int lineCounter = 0;
//bool inHeader = true;
bool isMatch = true; bool isMatch = true;
QList<QByteArray> tokens;
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text)) if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
{ {
@@ -2578,7 +2571,6 @@ bool FrameFileIO::loadLogFile(QString filename, QVector<CANFrame>* frames)
QFile *inFile = new QFile(filename); QFile *inFile = new QFile(filename);
CANFrame thisFrame; CANFrame thisFrame;
QByteArray line; QByteArray line;
uint64_t timeStamp = Utility::GetTimeMS();
int lineCounter = 0; int lineCounter = 0;
bool foundErrors = false; bool foundErrors = false;
@@ -2606,7 +2598,7 @@ bool FrameFileIO::loadLogFile(QString filename, QVector<CANFrame>* frames)
if (tokens.length() >= 6) if (tokens.length() >= 6)
{ {
QList<QByteArray> timeToks = tokens[0].split(':'); QList<QByteArray> timeToks = tokens[0].split(':');
timeStamp = (timeToks[0].toUInt() * (1000ul * 1000ul * 60ul * 60ul)) + (timeToks[1].toUInt() * (1000ul * 1000ul * 60ul)) uint64_t timeStamp = (timeToks[0].toUInt() * (1000ul * 1000ul * 60ul * 60ul)) + (timeToks[1].toUInt() * (1000ul * 1000ul * 60ul))
+ (timeToks[2].toUInt() * (1000ul * 1000ul)) + (timeToks[3].toUInt() * 100ul); + (timeToks[2].toUInt() * (1000ul * 1000ul)) + (timeToks[3].toUInt() * 100ul);
thisFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, timeStamp)); thisFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, timeStamp));
if (tokens[1].at(0) == 'R') thisFrame.isReceived = true; if (tokens[1].at(0) == 'R') thisFrame.isReceived = true;