diff --git a/connections/canbus.cpp b/connections/canbus.cpp
index 24238f7..97acc05 100644
--- a/connections/canbus.cpp
+++ b/connections/canbus.cpp
@@ -8,6 +8,7 @@ CANBus::CANBus()
listenOnly = false;
singleWire = false;
active = false;
+ canFD = false;
}
@@ -15,14 +16,16 @@ CANBus::CANBus(const CANBus& pBus) :
speed(pBus.speed),
listenOnly(pBus.listenOnly),
singleWire(pBus.singleWire),
- active(pBus.active) {}
+ active(pBus.active),
+ canFD(pBus.canFD) {}
bool CANBus::operator==(const CANBus& bus) const{
return speed == bus.speed &&
listenOnly == bus.listenOnly &&
singleWire == bus.singleWire &&
- active == bus.active;
+ active == bus.active &&
+ canFD == bus.canFD;
}
void CANBus::setSpeed(int newSpeed){
@@ -45,6 +48,11 @@ void CANBus::setActive(bool mode){
active = mode;
}
+void CANBus::setCanFD(bool mode){
+ //qDebug() << "CANBUS setCanFD = " << mode;
+ canFD = mode;
+}
+
int CANBus::getSpeed(){
return speed;
}
@@ -61,6 +69,10 @@ bool CANBus::isActive(){
return active;
}
+bool CANBus::isCanFD(){
+ return canFD;
+}
+
QDataStream& operator<<( QDataStream & pStream, const CANBus& pCanBus )
{
diff --git a/connections/canbus.h b/connections/canbus.h
index b127059..bcbe879 100644
--- a/connections/canbus.h
+++ b/connections/canbus.h
@@ -16,16 +16,18 @@ public:
bool listenOnly;
bool singleWire;
bool active; //is this bus turned on?
-
+ bool canFD;
void setSpeed(int); // new speed
void setListenOnly(bool); //bool for whether to only listen
void setSingleWire(bool); //bool for whether to use single wire mode
void setActive(bool); //whether this bus should be enabled or not.
+ void setCanFD(bool); // enable or disable CANFD support
int getSpeed();
bool isListenOnly();
bool isSingleWire();
bool isActive();
+ bool isCanFD();
};
QDataStream& operator<<( QDataStream & pStream, const CANBus& pCanBus );
diff --git a/connections/connectionwindow.cpp b/connections/connectionwindow.cpp
index d29ebd9..7695442 100644
--- a/connections/connectionwindow.cpp
+++ b/connections/connectionwindow.cpp
@@ -365,6 +365,7 @@ void ConnectionWindow::saveBusSettings()
bus.setSpeed(ui->cbBusSpeed->currentText().toInt());
bus.setActive(ui->ckEnable->isChecked());
bus.setListenOnly(ui->ckListenOnly->isChecked());
+ bus.setCanFD(ui->canFDEnable->isChecked());
conn_p->setBusSettings(offset, bus);
}
}
@@ -381,7 +382,8 @@ void ConnectionWindow::populateBusDetails(int offset)
{
//bool ret;
//int numBuses;
-
+ ui->canFDEnable->setVisible(false);
+ ui->canFDEnable_label->setVisible(false);
CANConnection* conn_p = connModel->getAtIdx(selIdx);
CANBus bus;
if(!conn_p) return;
@@ -396,6 +398,12 @@ void ConnectionWindow::populateBusDetails(int offset)
//ui->lblBusNum->setText(QString::number(busBase + offset));
ui->ckListenOnly->setChecked(bus.isListenOnly());
ui->ckEnable->setChecked(bus.isActive());
+ if (conn_p->getType() == CANCon::type::SERIALBUS)
+ {
+ ui->canFDEnable->setVisible(true);
+ ui->canFDEnable_label->setVisible(true);
+ ui->canFDEnable->setChecked(bus.isCanFD());
+ }
bool found = false;
for (int i = 0; i < ui->cbBusSpeed->count(); i++)
diff --git a/connections/serialbusconnection.cpp b/connections/serialbusconnection.cpp
index b1a2f6e..addaf21 100644
--- a/connections/serialbusconnection.cpp
+++ b/connections/serialbusconnection.cpp
@@ -47,6 +47,7 @@ void SerialBusConnection::piStarted()
mTimer.setSingleShot(false); //keep ticking
mTimer.start();
mBusData[0].mBus.setActive(true);
+ mBusData[0].mBus.setCanFD(false);
mBusData[0].mConfigured = true;
}
@@ -103,6 +104,7 @@ void SerialBusConnection::piSetBusSettings(int pBusIdx, CANBus bus)
//You cannot set the speed of a socketcan interface, it has to be set with console commands.
//But, you can probabaly set the speed of many of the other serialbus devices so go ahead and try
mDev_p->setConfigurationParameter(QCanBusDevice::BitRateKey, bus.speed);
+ mDev_p->setConfigurationParameter(QCanBusDevice::CanFdKey, bus.canFD);
/* connect device */
if (!mDev_p->connectDevice()) {
diff --git a/ui/connectionwindow.ui b/ui/connectionwindow.ui
index 0cf7ea4..6dd573d 100644
--- a/ui/connectionwindow.ui
+++ b/ui/connectionwindow.ui
@@ -64,9 +64,6 @@
Qt::AlignCenter
- -
-
-
-
-
@@ -107,15 +104,28 @@
- -
+
-
Save Bus Settings
+ -
+
+
+ -
+
+
+ Enable CAN FD:
+
+
+
+ -
+
+