Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can fd #18

Draft
wants to merge 2 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion DataStreamCAN/datastream_can.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ void DataStreamCAN::connectCanInterface()
for (const ConnectDialog::ConfigurationItem& item : p.configurations)
can_interface_->setConfigurationParameter(item.first, item.second);
}
can_interface_->setConfigurationParameter(QCanBusDevice::CanFdKey, true);

if (!can_interface_->connectDevice())
{
Expand Down Expand Up @@ -117,8 +118,14 @@ void DataStreamCAN::pushSingleCycle()
for (int i = 0; i < n_frames; i++)
{
auto frame = can_interface_->readFrame();
auto id = frame.frameId();
double timestamp = frame.timeStamp().seconds() + frame.timeStamp().microSeconds() * 1e-6;
frame_processor_->ProcessCanFrame(frame.frameId(), (const uint8_t*)frame.payload().data(), 8, timestamp);

//set bit 31 if extended, so that it is found in the dbc
if (id > 0x7FF)
id = id | (1<<31);
frame_processor_->ProcessCanFrame(id, (const uint8_t*)frame.payload().data(), frame.payload().length(), timestamp);
//qDebug() << tr("Processed Single Frame with id:%2 (length: %1)").arg(frame.payload().length()).arg(id);
}
}

Expand Down
2 changes: 2 additions & 0 deletions PluginsCommonCAN/CanFrameProcessor.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <QDebug>
#include "CanFrameProcessor.h"
#include "N2kMsg/GenericFastPacket.h"

Expand Down Expand Up @@ -91,6 +92,7 @@ bool CanFrameProcessor::ProcessCanFrameRaw(const uint32_t frame_id, const uint8_
}
else
{
//qDebug() << "Unknown FrameID!";
return false;
}
}
Expand Down