From 96523cc082c61704bef8e126e4439f28e7d89e1f Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Wed, 21 Dec 2016 20:19:23 -0500 Subject: [PATCH] Disable controls that don't do anything for socketcan --- connections/connectionwindow.cpp | 18 +++++++++++++++--- connections/socketcan.cpp | 3 +++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/connections/connectionwindow.cpp b/connections/connectionwindow.cpp index df71109..782385a 100644 --- a/connections/connectionwindow.cpp +++ b/connections/connectionwindow.cpp @@ -257,6 +257,7 @@ void ConnectionWindow::selectSerial() { /* set combobox page visible */ ui->stPort->setCurrentWidget(ui->cbPage); + ui->cbSpeed->setEnabled(true); ui->cbPort->clear(); ports = QSerialPortInfo::availablePorts(); @@ -269,6 +270,7 @@ void ConnectionWindow::selectKvaser() { /* set combobox page visible */ ui->stPort->setCurrentWidget(ui->cbPage); + ui->cbSpeed->setEnabled(false); } void ConnectionWindow::selectSocketCan() @@ -298,11 +300,21 @@ void ConnectionWindow::setPortName(CANCon::type pType, QString pPortName) switch(pType) { case CANCon::GVRET_SERIAL: - ui->rbGVRET->setChecked(true); break; + ui->rbGVRET->setChecked(true); + ui->cbSpeed->setEnabled(true); + ui->ckListenOnly->setEnabled(true); + ui->ckSingleWire->setEnabled(true); + break; case CANCon::KVASER: - ui->rbKvaser->setChecked(true); break; + ui->rbKvaser->setChecked(true); + break; case CANCon::SOCKETCAN: - ui->rbSocketCAN->setChecked(true); break; + ui->rbSocketCAN->setChecked(true); + //you can't configure any of the below three with socketcan so dim them out + ui->cbSpeed->setEnabled(false); + ui->ckListenOnly->setEnabled(false); + ui->ckSingleWire->setEnabled(false); + break; default: {} } diff --git a/connections/socketcan.cpp b/connections/socketcan.cpp index 771f686..fd6efc3 100644 --- a/connections/socketcan.cpp +++ b/connections/socketcan.cpp @@ -92,6 +92,9 @@ void SocketCan::piSetBusSettings(int pBusIdx, CANBus bus) mDev->setConfigurationParameter(item.first, item.second); }*/ + //You cannot set the speed of a socketcan interface, it has to be set with console commands. + //mDev_p->setConfigurationParameter(QCanBusDevice::BitRateKey, bus.speed); + /* connect device */ if (!mDev_p->connectDevice()) { disconnectDevice();