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:
- name: Prepare macOS Environment
run: |
brew install qt5
brew link qt5 --force
brew install qt@5
brew link qt@5 --force
- name: Clone
uses: actions/checkout@v3
@@ -74,8 +74,8 @@ jobs:
steps:
- name: Prepare macOS Environment
run: |
brew install qt5
brew link qt5 --force
brew install qt@5
brew link qt@5 --force
- name: Clone
uses: actions/checkout@v3
@@ -99,7 +99,7 @@ jobs:
buildwindows:
name: Windows x64
runs-on: windows-2019
runs-on: windows-2022
steps:
- name: Prepare Qt Libraries
@@ -111,8 +111,7 @@ jobs:
- name: Compile
shell: cmd
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
nmake /C
@@ -189,7 +188,7 @@ jobs:
release_msg="${release_msg//$'('/'-'}"
release_msg="${release_msg//$')'/'-'}"
echo $release_msg
echo "::set-output name=msg::$release_msg"
echo "{msg}={$release_msg}" >> $GITHUB_OUTPUT
- name: Notify Discord
run: |
+4 -4
View File
@@ -69,16 +69,16 @@ void CanLogServer::readNetworkData()
QString qstrId = lstMsg[0];
// Extract payload
QString qstrPayload = lstMsg[1];
// Support only normal can message. Extended CAN not supported.
if(qstrId.size() <= 4){
// Check ID size
if(qstrId.size() <= 4 || qstrId.size() == 8){
// Prepare the frame
CANFrame* frame_p = getQueue().get();
// Check for frame existence
if(frame_p){
// Set frame ID
frame_p->setFrameId(qstrId.toInt(nullptr, 16));
// Extended frame NOT SUPPORTED
frame_p->setExtendedFrameFormat(0);
// Extended frame
frame_p->setExtendedFrameFormat(frame_p->frameId() > 0x7FF);
// Set bus id
frame_p->bus = qstrCanId.toInt();
// 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
DBC_ATTRIBUTE *bgAttr = findAttributeByName("GenMsgBackgroundColor");
if (!bgAttr)
if (!findAttributeByName("GenMsgBackgroundColor"))
{
attr.attrType = ATTR_TYPE_MESSAGE;
attr.defaultValue = QApplication::palette().color(QPalette::Base).name();
@@ -1142,11 +1141,9 @@ bool DBCFile::loadFile(QString fileName)
attr.name = "GenMsgBackgroundColor";
attr.valType = ATTR_STRING;
dbc_attributes.append(attr);
bgAttr = findAttributeByName("GenMsgBackgroundColor");
}
DBC_ATTRIBUTE *fgAttr = findAttributeByName("GenMsgForegroundColor");
if (!fgAttr)
if (!findAttributeByName("GenMsgForegroundColor"))
{
attr.attrType = ATTR_TYPE_MESSAGE;
attr.defaultValue = QApplication::palette().color(QPalette::WindowText).name();
@@ -1156,7 +1153,6 @@ bool DBCFile::loadFile(QString fileName)
attr.name = "GenMsgForegroundColor";
attr.valType = ATTR_STRING;
dbc_attributes.append(attr);
fgAttr = findAttributeByName("GenMsgForegroundColor");
}
DBC_ATTRIBUTE *mc_attr = findAttributeByName("matchingcriteria");
@@ -1179,19 +1175,16 @@ bool DBCFile::loadFile(QString fileName)
messageHandler->setFilterLabeling(false);
}
QColor DefaultBG = QColor(bgAttr->defaultValue.toString());
QColor DefaultFG = QColor(fgAttr->defaultValue.toString());
DBC_ATTRIBUTE_VALUE *thisBG;
DBC_ATTRIBUTE_VALUE *thisFG;
QColor DefaultBG = QColor(findAttributeByName("GenMsgBackgroundColor")->defaultValue.toString());
QColor DefaultFG = QColor(findAttributeByName("GenMsgForegroundColor")->defaultValue.toString());
for (int x = 0; x < messageHandler->getCount(); x++)
{
DBC_MESSAGE *msg = messageHandler->findMsgByIdx(x);
msg->bgColor = DefaultBG;
msg->fgColor = DefaultFG;
thisBG = msg->findAttrValByName("GenMsgBackgroundColor");
thisFG = msg->findAttrValByName("GenMsgForegroundColor");
DBC_ATTRIBUTE_VALUE *thisBG = msg->findAttrValByName("GenMsgBackgroundColor");
DBC_ATTRIBUTE_VALUE *thisFG = msg->findAttrValByName("GenMsgForegroundColor");
if (thisBG) msg->bgColor = QColor(thisBG->value.toString());
if (thisFG) msg->fgColor = QColor(thisFG->value.toString());
for (int y = 0; y < msg->sigHandler->getCount(); y++)
@@ -1426,6 +1419,9 @@ bool DBCFile::saveFile(QString fileName)
case QVariant::Type::String:
attrValOutput.append("\"" + val.value.toString() + "\";\n");
break;
case QVariant::Type::Bool:
attrValOutput.append(QString::number(val.value.toBool() ? 1 : 0) + ";\n");
break;
default:
attrValOutput.append(val.value.toString() + ";\n");
break;
@@ -1471,6 +1467,9 @@ bool DBCFile::saveFile(QString fileName)
case QVariant::Type::String:
attrValOutput.append("\"" + val.value.toString() + "\";\n");
break;
case QVariant::Type::Bool:
attrValOutput.append(QString::number(val.value.toBool() ? 1 : 0) + ";\n");
break;
default:
attrValOutput.append(val.value.toString() + ";\n");
break;
@@ -1549,6 +1548,9 @@ bool DBCFile::saveFile(QString fileName)
case QVariant::Type::String:
attrValOutput.append("\"" + val.value.toString() + "\";\n");
break;
case QVariant::Type::Bool:
attrValOutput.append(QString::number(val.value.toBool() ? 1 : 0) + ";\n");
break;
default:
attrValOutput.append(val.value.toString() + ";\n");
break;
+8 -16
View File
@@ -1454,8 +1454,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
QByteArray bytes(numBytes, 0);
thisFrame.isReceived = true;
thisFrame.bus = 0;
if ((thisFrame.frameId() > 0x10000000) ||
(tokens[3].length() >= 8))
if ((thisFrame.frameId() > 0x10000000) || (tokens[3].length() >= 8))
{
thisFrame.setExtendedFrameFormat(true);
}
@@ -1464,7 +1463,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
thisFrame.setExtendedFrameFormat(false);
}
if (tokens[5] == "R")
if (tokens.value(5) == "R") // might be empty!
{
thisFrame.setFrameType(QCanBusFrame::RemoteRequestFrame);
}
@@ -1507,8 +1506,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
//qDebug() << thisFrame.payload().length();
thisFrame.isReceived = true;
thisFrame.bus = tokens[2].toInt();
if ((thisFrame.frameId() > 0x10000000) ||
(tokens[4].length() >= 8))
if ((thisFrame.frameId() > 0x10000000) || (tokens[4].length() >= 8))
{
thisFrame.setExtendedFrameFormat(true);
}
@@ -1516,7 +1514,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
{
thisFrame.setExtendedFrameFormat(false);
}
if (tokens[7] == "R")
if (tokens.value(7) == "R")
{
thisFrame.setFrameType(QCanBusFrame::RemoteRequestFrame);
}
@@ -1550,8 +1548,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
//qDebug() << thisFrame.payload().length();
thisFrame.isReceived = true;
thisFrame.bus = 0;
if ((thisFrame.frameId() > 0x10000000) ||
(tokens[3].length() >= 8))
if ((thisFrame.frameId() > 0x10000000) || (tokens[3].length() >= 8))
{
thisFrame.setExtendedFrameFormat(true);
}
@@ -1559,7 +1556,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
{
thisFrame.setExtendedFrameFormat(false);
}
if (tokens[6] == "R")
if (tokens.value(6) == "R")
{
thisFrame.setFrameType(QCanBusFrame::RemoteRequestFrame);
}
@@ -1603,8 +1600,7 @@ bool FrameFileIO::loadPCANFile(QString filename, QVector<CANFrame>* frames)
//qDebug() << thisFrame.payload().length();
thisFrame.isReceived = true;
thisFrame.bus = tokens[3].toInt();
if ((thisFrame.frameId() > 0x10000000) ||
(tokens[4].length() >= 8))
if ((thisFrame.frameId() > 0x10000000) || (tokens[4].length() >= 8))
{
thisFrame.setExtendedFrameFormat(true);
}
@@ -1646,10 +1642,7 @@ bool FrameFileIO::isCanalyzerASC(QString filename)
{
QFile *inFile = new QFile(filename);
QByteArray line;
//int lineCounter = 0;
//bool inHeader = true;
bool isMatch = true;
QList<QByteArray> tokens;
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
{
@@ -2578,7 +2571,6 @@ bool FrameFileIO::loadLogFile(QString filename, QVector<CANFrame>* frames)
QFile *inFile = new QFile(filename);
CANFrame thisFrame;
QByteArray line;
uint64_t timeStamp = Utility::GetTimeMS();
int lineCounter = 0;
bool foundErrors = false;
@@ -2606,7 +2598,7 @@ bool FrameFileIO::loadLogFile(QString filename, QVector<CANFrame>* frames)
if (tokens.length() >= 6)
{
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);
thisFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, timeStamp));
if (tokens[1].at(0) == 'R') thisFrame.isReceived = true;