diff --git a/connections/connectionwindow.cpp b/connections/connectionwindow.cpp index ff2125f..b1512ba 100644 --- a/connections/connectionwindow.cpp +++ b/connections/connectionwindow.cpp @@ -42,7 +42,7 @@ ConnectionWindow::ConnectionWindow(QWidget *parent) : ui->lineSend->setEnabled(false); /* load connection configuration */ - //loadConnections(); + loadConnections(); ui->rbSocketCAN->setEnabled(isSerialBusAvailable()); @@ -541,6 +541,9 @@ void ConnectionWindow::loadConnections() QVector driverNames = settings.value("connections/driverNames").value>(); QVector devTypes = settings.value("connections/types").value>(); + //don't load the connections if the three setting arrays above aren't all the same size. + if (portNames.count() != driverNames.count() || devTypes.count() != driverNames.count()) return; + for(int i = 0 ; i < portNames.count() ; i++) { CANConnection* conn_p = create((CANCon::type)devTypes[i], portNames[i], driverNames[i]); diff --git a/connections/gvretserial.cpp b/connections/gvretserial.cpp index 449ae2b..407da92 100644 --- a/connections/gvretserial.cpp +++ b/connections/gvretserial.cpp @@ -344,7 +344,7 @@ void GVRetSerial::connectDevice() serial->setFlowControl(serial->NoFlowControl); if (!serial->open(QIODevice::ReadWrite)) { - sendDebug("Error returned during port opening: " + serial->errorString()); + //sendDebug("Error returned during port opening: " + serial->errorString()); } else { @@ -359,7 +359,7 @@ void GVRetSerial::connectDevice() serial->setFlowControl(serial->HardwareControl); //Most GVRET style devices use hardware flow control if (!serial->open(QIODevice::ReadWrite)) { - sendDebug("Error returned during port opening: " + serial->errorString()); + //sendDebug("Error returned during port opening: " + serial->errorString()); } else { @@ -473,14 +473,17 @@ void GVRetSerial::serialError(QSerialPort::SerialPortError err) case QSerialPort::DeviceNotFoundError: errMessage = "Device not found error on serial"; killConnection = true; + piStop(); break; case QSerialPort::PermissionError: errMessage = "Permission error on serial port"; killConnection = true; + piStop(); break; case QSerialPort::OpenError: errMessage = "Open error on serial port"; killConnection = true; + piStop(); break; case QSerialPort::ParityError: errMessage = "Parity error on serial port"; @@ -500,6 +503,7 @@ void GVRetSerial::serialError(QSerialPort::SerialPortError err) case QSerialPort::ResourceError: errMessage = "Serial port seems to have disappeared."; killConnection = true; + piStop(); break; case QSerialPort::UnsupportedOperationError: errMessage = "Unsupported operation on serial port"; @@ -516,6 +520,7 @@ void GVRetSerial::serialError(QSerialPort::SerialPortError err) case QSerialPort::NotOpenError: errMessage = "The serial port isn't open"; killConnection = true; + piStop(); break; } /* diff --git a/mainwindow.cpp b/mainwindow.cpp index ff65fb3..7590ad6 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -184,7 +184,7 @@ MainWindow::MainWindow(QWidget *parent) : ui->actionFirmware_Update->setVisible(false); ui->actionMotorControlConfig->setVisible(false); ui->actionSignal_Viewer->setVisible(false); - //ui->actionSingle_Multi_State_2->setVisible(false); + ui->actionSingle_Multi_State_2->setVisible(false); installEventFilter(this); }