Minor: added debug output in error case

This commit is contained in:
Gerhard Hoffmann 2024-10-15 12:45:38 +02:00
parent 4c770349bf
commit ca2d9e1b5a

View File

@ -556,23 +556,27 @@ char T_datif::loadRecDataFromFrame()
if (readSource == myDCIF->getReadSource() && readSource == readCmds[0]) {
// maybe we have sent a explicit request for a test-response
if (waitForTestResponse) {
qCritical() << __func__ << ":" << __LINE__ << "turn on auto-request";
if (readCmds[0] == CMD2DC_TestSerial) {
if (QString(QByteArray((char const *)receivedData, RdDleng)) == "< SlaveResponse") {
waitForTestResponse = false;
qCritical() << __func__ << ":" << __LINE__ << "turn on auto-request";
((hwapi *)parent())->dc_autoRequest(true); // return autorequest to true
} else {
qCritical() << __func__ << ":" << __LINE__ << "received wrong test-response"
qCritical() << __func__ << ":" << __LINE__ << "ERROR received wrong test-response"
<< QString(QByteArray((char const *)receivedData, RdDleng));
}
}
} else {
// usual handling of response
// qCritical() << __func__ << ":" << __LINE__ << ":" << readSource << myDCIF->getReadSource() << readCmds[0];
// qCritical() << __func__ << ":" << __LINE__ << ":" << QByteArray((char const *)receivedData, RdDleng).toHex(':');
}
readCmds.clear();
} else { // error
qCritical() << __func__ << ":" << __LINE__ << ":" << readSource << myDCIF->getReadSource() << readCmds[0];
qCritical() << __func__ << ":" << __LINE__ << ":" << QByteArray((char const *)receivedData, RdDleng).toHex(':');
qCritical() << __func__ << ":" << __LINE__ << ": ERROR " << readSource << myDCIF->getReadSource() << readCmds[0];
qCritical() << __func__ << ":" << __LINE__ << ": ERROR length" << RdDleng << QString(", ignore data for cmd 0x%1").arg(readCmds[0], 0, 16)
<< QByteArray((char const *)receivedData, RdDleng).toHex(':');
readCmds.clear();
return 0;
}
@ -583,8 +587,8 @@ char T_datif::loadRecDataFromFrame()
// again.
readCmds.clear();
if (parent()) {
qCritical() << __func__ << ":" << __LINE__ << "turn off auto-request";
qCritical() << __func__ << ":" << __LINE__ << "send request for test-response";
qCritical() << __func__ << ":" << __LINE__ << "ERROR turn off auto-request";
qCritical() << __func__ << ":" << __LINE__ << "ERROR send request for test-response";
waitForTestResponse = true;
((hwapi *)parent())->dc_autoRequest(false);
((hwapi *)parent())->dc_requTestResponse();