Fix to correct a few places where 2 buses were hard coded as the
limit. There is no hard and fast limit to the number of buses you can have now.
This commit is contained in:
+3
-1
@@ -8,6 +8,7 @@
|
||||
#include <QApplication>
|
||||
#include <QPalette>
|
||||
#include "utility.h"
|
||||
#include "connections/canconmanager.h"
|
||||
|
||||
DBCHandler* DBCHandler::instance = nullptr;
|
||||
|
||||
@@ -291,8 +292,9 @@ int DBCFile::getAssocBus()
|
||||
|
||||
void DBCFile::setAssocBus(int bus)
|
||||
{
|
||||
int numBuses = CANConManager::getInstance()->getNumBuses();
|
||||
if (bus < -1) return;
|
||||
if (bus > 1) return;
|
||||
if (bus >= numBuses) return;
|
||||
assocBuses = bus;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "ui_dbcloadsavewindow.h"
|
||||
#include <QCheckBox>
|
||||
#include "helpwindow.h"
|
||||
#include "connections/canconmanager.h"
|
||||
|
||||
DBCLoadSaveWindow::DBCLoadSaveWindow(const QVector<CANFrame> *frames, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
@@ -162,7 +163,8 @@ void DBCLoadSaveWindow::cellChanged(int row, int col)
|
||||
{
|
||||
DBCFile *file = dbcHandler->getFileByIdx(row);
|
||||
int bus = ui->tableFiles->item(row, col)->text().toInt();
|
||||
if (bus > -2 && bus < 2)
|
||||
int numBuses = CANConManager::getInstance()->getNumBuses();
|
||||
if (bus > -2 && bus < numBuses)
|
||||
{
|
||||
file->setAssocBus(bus);
|
||||
}
|
||||
|
||||
@@ -820,6 +820,8 @@ void FrameSenderWindow::processCellChange(int line, int col)
|
||||
|
||||
sendingData[line].count = 0;
|
||||
|
||||
int numBuses = CANConManager::getInstance()->getNumBuses();
|
||||
|
||||
switch (col)
|
||||
{
|
||||
case 0: //Enable check box
|
||||
@@ -832,8 +834,8 @@ void FrameSenderWindow::processCellChange(int line, int col)
|
||||
break;
|
||||
case 1: //Bus designation
|
||||
tempVal = Utility::ParseStringToNum(ui->tableSender->item(line, 1)->text());
|
||||
if (tempVal < 0) tempVal = 0;
|
||||
if (tempVal > 1) tempVal = 1;
|
||||
if (tempVal < -1) tempVal = -1;
|
||||
if (tempVal >= numBuses) tempVal = numBuses - 1;
|
||||
sendingData[line].bus = tempVal;
|
||||
qDebug() << "Setting bus to " << tempVal;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user