some bugfixes and improvements

This commit is contained in:
Robin Müller 2020-09-02 17:59:26 +02:00
parent 15bb0aee98
commit ae9bc39bda
2 changed files with 10 additions and 5 deletions

View File

@ -678,7 +678,7 @@ void DeviceHandlerBase::doGetRead() {
void DeviceHandlerBase::parseReply(const uint8_t* receivedData,
size_t receivedDataLen) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
DeviceCommandId_t foundId = 0xFFFFFFFF;
DeviceCommandId_t foundId = 0xffffffff;
size_t foundLen = 0;
// The loop may not execute more often than the number of received bytes
// (worst case). This approach avoids infinite loops due to buggy
@ -709,7 +709,7 @@ void DeviceHandlerBase::parseReply(const uint8_t* receivedData,
break;
}
case IGNORE_REPLY_DATA:
break;
continue;
case IGNORE_FULL_PACKET:
return;
default:
@ -741,16 +741,19 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData,
DeviceReplyInfo *info = &(iter->second);
if (info->delayCycles != 0) {
result = interpretDeviceReply(foundId, receivedData);
if (info->periodic != false) {
if(result == IGNORE_REPLY_DATA) {
return;
}
if (info->periodic) {
info->delayCycles = info->maxDelayCycles;
}
else {
info->delayCycles = 0;
}
result = interpretDeviceReply(foundId, receivedData);
if (result != RETURN_OK) {
// Report failed interpretation to FDIR.
replyRawReplyIfnotWiretapped(receivedData, foundLen);

View File

@ -323,6 +323,8 @@ protected:
* @param packet
* @return
* - @c RETURN_OK when the reply was interpreted.
* - @c IGNORE_REPLY_DATA Ignore the reply and don't reset reply cycle
* counter.
* - @c RETURN_FAILED when the reply could not be interpreted,
* e.g. logical errors or range violations occurred
*/