Changeset - b92cff56c8ed
[Not reviewed]
default
0 1 0
Hasan Yavuz Ă–ZDERYA - 11 years ago 2015-05-28 10:27:56
hy@ozderya.net
fix duplicate error message during -failed- port opening
1 file changed with 0 insertions and 4 deletions:
0 comments (0 inline, 0 general)
portcontrol.cpp
Show inline comments
 
@@ -204,52 +204,48 @@ void PortControl::togglePort()
 
{
 
    if (serialPort->isOpen())
 
    {
 
        serialPort->close();
 
        qDebug() << "Port closed, " << serialPort->portName();
 
        emit portToggled(false);
 
    }
 
    else
 
    {
 
        serialPort->setPortName(ui->cbPortList->currentText());
 

	
 
        // open port
 
        if (serialPort->open(QIODevice::ReadWrite))
 
        {
 
            // set port settings
 
            selectBaudRate(ui->cbBaudRate->currentText());
 
            selectParity((QSerialPort::Parity) parityButtons.checkedId());
 
            selectDataBits((QSerialPort::DataBits) dataBitsButtons.checkedId());
 
            selectStopBits((QSerialPort::StopBits) stopBitsButtons.checkedId());
 
            selectFlowControl((QSerialPort::FlowControl) flowControlButtons.checkedId());
 

	
 
            qDebug() << "Port opened, " << serialPort->portName();
 
            emit portToggled(true);
 
        }
 
        else
 
        {
 
            qDebug() << "Port open error: " << serialPort->error();
 
        }
 
    }
 
    ui->pbOpenPort->setChecked(serialPort->isOpen());
 
}
 

	
 
void PortControl::selectPort(QString portName)
 
{
 
    // has selection actually changed
 
    if (portName != serialPort->portName())
 
    {
 
        // if another port is already open, close it by toggling
 
        if (serialPort->isOpen())
 
        {
 
            togglePort();
 

	
 
            // open new selection by toggling
 
            togglePort();
 
        }
 
    }
 
}
 

	
 
void PortControl::enableSkipByte(bool enabled)
 
{
 
    ui->pbSkipByte->setDisabled(enabled);
 
}
0 comments (0 inline, 0 general)