Disable controls that don't do anything for socketcan

This commit is contained in:
Collin Kidder
2016-12-21 20:19:23 -05:00
parent 9cceb4404d
commit 96523cc082
2 changed files with 18 additions and 3 deletions
+15 -3
View File
@@ -257,6 +257,7 @@ void ConnectionWindow::selectSerial()
{ {
/* set combobox page visible */ /* set combobox page visible */
ui->stPort->setCurrentWidget(ui->cbPage); ui->stPort->setCurrentWidget(ui->cbPage);
ui->cbSpeed->setEnabled(true);
ui->cbPort->clear(); ui->cbPort->clear();
ports = QSerialPortInfo::availablePorts(); ports = QSerialPortInfo::availablePorts();
@@ -269,6 +270,7 @@ void ConnectionWindow::selectKvaser()
{ {
/* set combobox page visible */ /* set combobox page visible */
ui->stPort->setCurrentWidget(ui->cbPage); ui->stPort->setCurrentWidget(ui->cbPage);
ui->cbSpeed->setEnabled(false);
} }
void ConnectionWindow::selectSocketCan() void ConnectionWindow::selectSocketCan()
@@ -298,11 +300,21 @@ void ConnectionWindow::setPortName(CANCon::type pType, QString pPortName)
switch(pType) switch(pType)
{ {
case CANCon::GVRET_SERIAL: 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: case CANCon::KVASER:
ui->rbKvaser->setChecked(true); break; ui->rbKvaser->setChecked(true);
break;
case CANCon::SOCKETCAN: 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: {} default: {}
} }
+3
View File
@@ -92,6 +92,9 @@ void SocketCan::piSetBusSettings(int pBusIdx, CANBus bus)
mDev->setConfigurationParameter(item.first, item.second); 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 */ /* connect device */
if (!mDev_p->connectDevice()) { if (!mDev_p->connectDevice()) {
disconnectDevice(); disconnectDevice();