From 4accf1b559833371635539b101a23f6ce49c5a1c Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 4 Mar 2021 21:10:00 +0000 Subject: [PATCH] Update pttyhandler.cpp --- pttyhandler.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/pttyhandler.cpp b/pttyhandler.cpp index bf67547..b9205b7 100644 --- a/pttyhandler.cpp +++ b/pttyhandler.cpp @@ -149,26 +149,20 @@ void pttyHandler::sendDataOut(const QByteArray& writeData) mutex.lock(); -#ifdef QT_DEBUG qDebug(logSerial()) << "Data to term:"; printHex(writeData, false, true); - qint64 bytesWritten; + qint64 bytesWritten=0; - if (inPortData[2] != (char)0xE1) { + if (inPortData[2] != (char)0xE1 && inPortData[3] != (char)0xE1) { bytesWritten = port->write(writeData); + if (bytesWritten != writeData.length()) { + qDebug(logSerial()) << "bytesWritten: " << bytesWritten << " length of byte array: " << writeData.length()\ + << " size of byte array: " << writeData.size()\ + << " Wrote all bytes? " << (bool)(bytesWritten == (qint64)writeData.size()); + } } - if (bytesWritten != writeData.length()) { - qDebug(logSerial()) << "bytesWritten: " << bytesWritten << " length of byte array: " << writeData.length()\ - << " size of byte array: " << writeData.size()\ - << " Wrote all bytes? " << (bool)(bytesWritten == (qint64)writeData.size()); - } -#else - if (inPortData[2] != (char)0xE1) { - port->write(writeData); - } -#endif mutex.unlock(); }