From 383d4a2f1f54c8adf8b1dd86baa7edd4440e76d4 Mon Sep 17 00:00:00 2001 From: Serhii Voloshynov Date: Fri, 28 Feb 2020 10:49:45 +0200 Subject: fix unitialized m_eFlowControl and serial settings --- src/MTS_IO_SerialConnection.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/MTS_IO_SerialConnection.cpp b/src/MTS_IO_SerialConnection.cpp index c91f5d5..a12a09b 100644 --- a/src/MTS_IO_SerialConnection.cpp +++ b/src/MTS_IO_SerialConnection.cpp @@ -50,6 +50,7 @@ SerialConnection::Builder::Builder(const std::string& sPortName) , m_eParity(OFF) , m_eDataBits(B8) , m_eStopBits(B1) +, m_eFlowControl(NONE) , m_bBuilt(false) { @@ -424,6 +425,7 @@ bool SerialConnection::doOpen(const int32_t& timeoutMillis) { } //Set Parity, Stop Bits, and Data Length + options.c_cflag &= ~(PARODD | PARENB); switch(m_eParity) { case ODD: options.c_cflag |= ( PARODD | PARENB ); @@ -434,8 +436,6 @@ bool SerialConnection::doOpen(const int32_t& timeoutMillis) { break; case OFF: - default: - options.c_cflag &= ~PARENB; break; } @@ -461,7 +461,7 @@ bool SerialConnection::doOpen(const int32_t& timeoutMillis) { switch(m_eStopBits) { case B2: - options.c_cflag &= CSTOPB; + options.c_cflag |= CSTOPB; break; case B1: @@ -472,11 +472,11 @@ bool SerialConnection::doOpen(const int32_t& timeoutMillis) { switch (m_eFlowControl) { case RTS_CTS: - options.c_cflag &= CRTSCTS; + options.c_cflag |= CRTSCTS; break; case NONE: default: - options.c_cflag &= ~(IXON | IXOFF | IXANY); + options.c_cflag &= ~CRTSCTS; break; } -- cgit v1.2.3