Bug fixes in connection code, some commented out debugging statements used only for specific debugging

This commit is contained in:
Collin Kidder
2016-12-19 20:46:59 -05:00
parent 0f3f9e0fad
commit cdfb7661a1
2 changed files with 9 additions and 3 deletions
+6 -1
View File
@@ -103,6 +103,8 @@ CANConnection* CANConManager::getByName(const QString& pName) const
void CANConManager::refreshConnection(CANConnection* pConn_p) void CANConManager::refreshConnection(CANConnection* pConn_p)
{ {
if (pConn_p->getQueue().peek() == NULL) return;
CANFrame* frame_p = NULL; CANFrame* frame_p = NULL;
QVector<CANFrame> frames; QVector<CANFrame> frames;
@@ -117,8 +119,11 @@ void CANConManager::refreshConnection(CANConnection* pConn_p)
else break; else break;
} }
//qDebug() << "Bus fixup number: " << busBase;
while( (frame_p = pConn_p->getQueue().peek() ) ) { while( (frame_p = pConn_p->getQueue().peek() ) ) {
frame_p->bus += busBase; frame_p->bus += busBase;
//qDebug() << "Rx of frame from bus: " << frame_p->bus;
frames.append(*frame_p); frames.append(*frame_p);
pConn_p->getQueue().dequeue(); pConn_p->getQueue().dequeue();
} }
@@ -147,7 +152,7 @@ bool CANConManager::sendFrame(const CANFrame& pFrame)
foreach (CANConnection* conn, mConns) foreach (CANConnection* conn, mConns)
{ {
//check if this CAN connection is supposed to handle the requested bus //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.bus -= busBase;
workingFrame.isReceived = false; workingFrame.isReceived = false;
+3 -2
View File
@@ -150,7 +150,7 @@ bool GVRetSerial::piSendFrame(const CANFrame& frame)
CANFrame tempFrame = frame; CANFrame tempFrame = frame;
tempFrame.isReceived = false; 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++; framesRapid++;
@@ -301,7 +301,7 @@ void GVRetSerial::readSerialData()
{ {
QByteArray data = serial->readAll(); QByteArray data = serial->readAll();
unsigned char c; 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++) for (int i = 0; i < data.length(); i++)
{ {
c = data.at(i); c = data.at(i);
@@ -413,6 +413,7 @@ void GVRetSerial::procRXChar(unsigned char c)
/* get frame from queue */ /* get frame from queue */
CANFrame* frame_p = getQueue().get(); CANFrame* frame_p = getQueue().get();
if(frame_p) { if(frame_p) {
//qDebug() << "GVRET got frame on bus " << frame_p->bus;
/* copy frame */ /* copy frame */
*frame_p = buildFrame; *frame_p = buildFrame;
/* enqueue frame */ /* enqueue frame */