Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Fixed error recovery #316

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lmartorella
Copy link

Hi,
I've found an issue in cleaning up the RTU module state, that happens in one of the following cases of incoming packet:

  • a CRC error is detected (e.g. malformed packet or transmission error due to noisy line);
  • a custom cbRaw callback is installed and a EX_PASSTHROUGH is returned when the frame was not valid, but the CRC was ok;

In these cases, the state of the receiver is not correctly reset, and it is impossible to send new packets (e.g. the send() always returns false) until the timeout elapsed. This is because the cleanup() function only acts after MODBUSRTU_TIMEOUT_US timeout.

Setting _slaveId = 0 at the end of the task() fixes the issue.
It is also probably better to get rid of the goto used in the task() function and linting it.

Thanks!
L

@lmartorella lmartorella changed the title - FIxed error recovery - Fixed error recovery Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant