From b18c30724ea3dff9a364f1e78570c8e03636bccd Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Mon, 2 Jan 2017 17:25:02 -0500 Subject: [PATCH] A bit better debugging messages, fix up filtering for firmware updater --- connections/canconnection.cpp | 4 +++- firmwareuploaderwindow.cpp | 10 ++++------ scriptcontainer.cpp | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/connections/canconnection.cpp b/connections/canconnection.cpp index 663817c..41b6329 100644 --- a/connections/canconnection.cpp +++ b/connections/canconnection.cpp @@ -278,7 +278,7 @@ bool CANConnection::addTargettedFrame(int pBusId, uint32_t ID, uint32_t mask, QO for (int i = 0; i < getNumBuses(); i++) { if ( (pBusId == -1) || (pBusId && (1 << i)) ) { - qDebug() << "Connection is registering a new targetted frame filter"; + qDebug() << "Connection is registering a new targetted frame filter, local bus " << i; CANFlt target; target.id = ID; target.mask = mask; @@ -339,8 +339,10 @@ bool CANConnection::removeAllTargettedFrames(QObject *receiver) void CANConnection::checkTargettedFrame(CANFrame &frame) { unsigned int maskedID; + qDebug() << "Got frame with ID " << frame.ID << " on bus " << frame.bus; foreach (const CANFlt filt, mBusData_p[frame.bus].mTargettedFrames) { + qDebug() << "Checking filter with id " << filt.id << " mask " << filt.mask; maskedID = frame.ID & filt.mask; if (maskedID == filt.id) { qDebug() << "In connection object I got a targetted frame. Forwarding it."; diff --git a/firmwareuploaderwindow.cpp b/firmwareuploaderwindow.cpp index 3aa788e..19ae9e4 100644 --- a/firmwareuploaderwindow.cpp +++ b/firmwareuploaderwindow.cpp @@ -25,10 +25,7 @@ FirmwareUploaderWindow::FirmwareUploaderWindow(const QVector *frames, updateProgress(); timer = new QTimer(); - timer->setInterval(100); //100ms without a reply will cause us to attempt a resend - - CANConManager::getInstance()->addTargettedFrame(-1, 0x100, 0x7F0, this); - //MainWindow::getReference()->setTargettedID(baseAddress + 0x10); + timer->setInterval(100); //100ms without a reply will cause us to attempt a resend connect(MainWindow::getReference(), SIGNAL(framesUpdated(int)), this, SLOT(updatedFrames(int))); connect(ui->btnLoadFile, SIGNAL(clicked(bool)), this, SLOT(handleLoadFile())); @@ -170,7 +167,8 @@ void FirmwareUploaderWindow::handleStartStopTransfer() bus = ui->spinBus->value(); baseAddress = Utility::ParseStringToNum(ui->txtBaseAddr->text()); qDebug() << "Base address: " + QString::number(baseAddress); - //MainWindow::getReference()->setTargettedID(baseAddress + 0x10); + CANConManager::getInstance()->addTargettedFrame(bus, baseAddress + 0x10, 0x7FF, this); + CANConManager::getInstance()->addTargettedFrame(bus, baseAddress + 0x20, 0x7FF, this); CANFrame *output = new CANFrame; output->extended = false; output->len = 8; @@ -190,7 +188,7 @@ void FirmwareUploaderWindow::handleStartStopTransfer() else //stop anything in process { ui->btnStartStop->setText("Start Upload"); - //MainWindow::getReference()->setTargettedID(-1); + CANConManager::getInstance()->removeAllTargettedFrames(this); } } diff --git a/scriptcontainer.cpp b/scriptcontainer.cpp index 3d326ce..66e120c 100644 --- a/scriptcontainer.cpp +++ b/scriptcontainer.cpp @@ -105,8 +105,7 @@ void ScriptContainer::clearFilters() CANConnection* conn_p = CANConManager::getInstance()->getByName(mConName); if(conn_p) { - //for(int i=0 ; igetNumBuses() ; i++) - //conn_p->setFilters(i, QVector(), false); + conn_p->removeAllTargettedFrames(this); } }