diff --git a/src/com.cpp b/src/com.cpp index 91f2982..859717a 100644 --- a/src/com.cpp +++ b/src/com.cpp @@ -47,7 +47,7 @@ void T_com::writeToSerial(const QByteArray &data, uint16_t sendLength) int bytesToWrite = buffer.size(); while (bytesToWrite > 0 && !buffer.isEmpty()) { int bytesWritten = CatSerial->write(buffer); - if (bytesWritten != -1 && CatSerial->waitForBytesWritten(1000)) { + if (bytesWritten != -1) { bytesToWrite -= bytesWritten; buffer = buffer.right(bytesWritten); } else { @@ -67,13 +67,14 @@ void T_com::writeToSerial(const QByteArray &data, uint16_t sendLength) << "ERROR sending" << data.toHex(':') << "port is not open"; } } else { - qCritical() << __func__ << "" << __LINE__ << "ERROR detected active read cmd" << readCmds[0]; + qCritical() << __func__ << "" << __LINE__ << errorCnt << "ERROR about to send cmd" << QString("0x%1").arg((unsigned char)data.constData()[2], 0, 16); + qCritical() << __func__ << "" << __LINE__ << errorCnt << "ERROR detected active read cmds" << readCmds; if (CatSerial->isOpen()) { int availableBytes = CatSerial->bytesAvailable(); qCritical() << __func__ << "" << __LINE__ << "ERROR available bytes" << availableBytes; if (availableBytes == 0) { errorCnt += 1; - if (errorCnt > 100) { + if (errorCnt > 20) { readCmds.clear(); errorCnt = 0; }