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

View File

@ -323,6 +323,8 @@ protected:
* @param packet * @param packet
* @return * @return
* - @c RETURN_OK when the reply was interpreted. * - @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, * - @c RETURN_FAILED when the reply could not be interpreted,
* e.g. logical errors or range violations occurred * e.g. logical errors or range violations occurred
*/ */