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

readPacketUntilAvailable has weird behaviour #79

Open
Ruudjhuu opened this issue May 23, 2019 · 1 comment
Open

readPacketUntilAvailable has weird behaviour #79

Ruudjhuu opened this issue May 23, 2019 · 1 comment

Comments

@Ruudjhuu
Copy link

when using this funciton, it works the first time and all the other times after, i get the same response.

my case:
I send DN (Detect node) request as an atcommandrequest option. When no device should be found, the function spend ten seconds waiting and then returns no device found. Just as it should. However, when the function is called the second time, it receives the same response within 1 ms.

I added ggetResponse().reset(); between line 850 and 851 and it works now.

@matthijskooijman
Copy link
Contributor

This indeed looks like a bug. Your suggested fix seems reasonable to me, though it is probably better to call resetResponse() instead. One alternative would be to put a readPacket() in front of the loop (or turn it into a do/while loop), to make sure readPacket() is called at least once (which also resets the response).

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

No branches or pull requests

2 participants