From 6ef4c2ddfa19ef2468b43c939ae30015dfd184e2 Mon Sep 17 00:00:00 2001 From: Andy Huska Date: Wed, 2 Nov 2022 15:26:07 -0500 Subject: [PATCH] Fixed the queue of TX messages. Had to be moved to the worker thread. --- connections/canconmanager.cpp | 14 ++++++++------ connections/canconnection.cpp | 5 ++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/connections/canconmanager.cpp b/connections/canconmanager.cpp index e738432..45d9c67 100644 --- a/connections/canconmanager.cpp +++ b/connections/canconmanager.cpp @@ -228,14 +228,10 @@ bool CANConManager::sendFrame(const CANFrame& pFrame) workingFrame.setTimeStamp(QCanBusFrame::TimeStamp(0, mElapsedTimer.nsecsElapsed() / 1000)); //workingFrame.timestamp -= mTimestampBasis; } - //txFrame = conn->getQueue().get(); - QCoreApplication::processEvents(); - //*txFrame = workingFrame; - //conn->getQueue().queue(); - //copy pframe so the stack can be used while we send, prevents needing BlockingQueuedConnection + // CANFrame frameCopy; // frameCopy.bus = workingFrame.bus; // //cFrame.timedelta @@ -263,7 +259,13 @@ bool CANConManager::sendFrame(const CANFrame& pFrame) // frameCopy.setError(workingFrame.error()); // ///* If recorded frame has a local echo, it is a Tx message, and thus should not be marked as Rx */ // frameCopy.isReceived = workingFrame.isReceived; - //////////////////////////////////////////// +// //////////////////////////////////////////// + + +// txFrame = conn->getQueue().get(); +// QCoreApplication::processEvents(); +// *txFrame = frameCopy; //workingFrame +// conn->getQueue().queue(); return conn->sendFrame(workingFrame); diff --git a/connections/canconnection.cpp b/connections/canconnection.cpp index 3711f13..8edd17c 100644 --- a/connections/canconnection.cpp +++ b/connections/canconnection.cpp @@ -173,7 +173,10 @@ bool CANConnection::sendFrame(const CANFrame& pFrame) return ret; } - + CANFrame *txFrame; + txFrame = getQueue().get(); + *txFrame = pFrame; + getQueue().queue(); return piSendFrame(pFrame); }