Added/corrected timestamps for LAWICEL protocol.

Fixed System Clock timestamps and added decoding for timestamps coming from the tool.
This commit is contained in:
Superwofy
2024-06-21 12:55:26 +01:00
parent 17d369491d
commit 6da492f0eb
2 changed files with 21 additions and 1 deletions
+20 -1
View File
@@ -491,7 +491,26 @@ void LAWICELSerial::readSerialData()
{
qDebug() << "Got CR!";
buildFrame.setTimeStamp(QDateTime::currentMSecsSinceEpoch() * 1000l);
if (useSystemTime)
{
buildTimestamp = QDateTime::currentMSecsSinceEpoch() * 1000l;
}
else
{
//If total length is greater than command, header and data, timestamps must be enabled.
if (data.length() > (5 + mBuildLine.mid(4, 1).toInt() * 2 + 1))
{
//Four bytes after the end of the data bytes.
buildTimestamp = mBuildLine.mid(5 + mBuildLine.mid(4, 1).toInt() * 2, 4).toInt(nullptr, 16) * 1000l;
}
else
{
//Default to system time if timestamps are disabled.
buildTimestamp = QDateTime::currentMSecsSinceEpoch() * 1000l;
}
}
buildFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, buildTimestamp));
switch (mBuildLine[0].toLatin1())
{
case 't': //standard frame
+1
View File
@@ -61,6 +61,7 @@ protected:
QSerialPort *serial;
int framesRapid;
CANFrame buildFrame;
qint64 buildTimestamp;
bool can0Enabled;
bool can0ListenOnly;
bool canFd;