A bit better debugging messages, fix up filtering for firmware updater

This commit is contained in:
Collin Kidder
2017-01-02 17:25:02 -05:00
parent 2758fa8a09
commit b18c30724e
3 changed files with 8 additions and 9 deletions
+3 -1
View File
@@ -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.";
+3 -5
View File
@@ -27,9 +27,6 @@ FirmwareUploaderWindow::FirmwareUploaderWindow(const QVector<CANFrame> *frames,
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);
connect(MainWindow::getReference(), SIGNAL(framesUpdated(int)), this, SLOT(updatedFrames(int)));
connect(ui->btnLoadFile, SIGNAL(clicked(bool)), this, SLOT(handleLoadFile()));
connect(ui->btnStartStop, SIGNAL(clicked(bool)), this, SLOT(handleStartStopTransfer()));
@@ -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);
}
}
+1 -2
View File
@@ -105,8 +105,7 @@ void ScriptContainer::clearFilters()
CANConnection* conn_p = CANConManager::getInstance()->getByName(mConName);
if(conn_p)
{
//for(int i=0 ; i<conn_p->getNumBuses() ; i++)
//conn_p->setFilters(i, QVector<CANFlt>(), false);
conn_p->removeAllTargettedFrames(this);
}
}