diff --git a/connections/canconmanager.cpp b/connections/canconmanager.cpp index 008ee03..4dc857d 100644 --- a/connections/canconmanager.cpp +++ b/connections/canconmanager.cpp @@ -103,6 +103,8 @@ CANConnection* CANConManager::getByName(const QString& pName) const void CANConManager::refreshConnection(CANConnection* pConn_p) { + if (pConn_p->getQueue().peek() == NULL) return; + CANFrame* frame_p = NULL; QVector frames; @@ -117,8 +119,11 @@ void CANConManager::refreshConnection(CANConnection* pConn_p) else break; } + //qDebug() << "Bus fixup number: " << busBase; + while( (frame_p = pConn_p->getQueue().peek() ) ) { frame_p->bus += busBase; + //qDebug() << "Rx of frame from bus: " << frame_p->bus; frames.append(*frame_p); pConn_p->getQueue().dequeue(); } @@ -147,7 +152,7 @@ bool CANConManager::sendFrame(const CANFrame& pFrame) foreach (CANConnection* conn, mConns) { //check if this CAN connection is supposed to handle the requested bus - if (pFrame.bus <= busBase + conn->getNumBuses()) + if (pFrame.bus < busBase + conn->getNumBuses()) { workingFrame.bus -= busBase; workingFrame.isReceived = false; diff --git a/connections/gvretserial.cpp b/connections/gvretserial.cpp index 90a79a1..b6940f0 100644 --- a/connections/gvretserial.cpp +++ b/connections/gvretserial.cpp @@ -150,7 +150,7 @@ bool GVRetSerial::piSendFrame(const CANFrame& frame) CANFrame tempFrame = frame; tempFrame.isReceived = false; - //qDebug() << "Sending out frame with id " << frame->ID; + //qDebug() << "Sending out GVRET frame with id " << frame.ID << " on bus " << frame.bus; framesRapid++; @@ -301,7 +301,7 @@ void GVRetSerial::readSerialData() { QByteArray data = serial->readAll(); unsigned char c; - qDebug() << (tr("Got data from serial. Len = %0").arg(data.length())); + //qDebug() << (tr("Got data from serial. Len = %0").arg(data.length())); for (int i = 0; i < data.length(); i++) { c = data.at(i); @@ -413,6 +413,7 @@ void GVRetSerial::procRXChar(unsigned char c) /* get frame from queue */ CANFrame* frame_p = getQueue().get(); if(frame_p) { + //qDebug() << "GVRET got frame on bus " << frame_p->bus; /* copy frame */ *frame_p = buildFrame; /* enqueue frame */