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

"getComplexData" needs a time-out safety #15

Open
eawag-squid opened this issue Feb 9, 2021 · 1 comment
Open

"getComplexData" needs a time-out safety #15

eawag-squid opened this issue Feb 9, 2021 · 1 comment

Comments

@eawag-squid
Copy link

Dear author:

Thank you for you work. This library works very reliably for us. We did have to make a small change though to the function "getComplexData". The while-loop in there may hang and the function may run indefinitely.

We changed the code around the while loop waiting for the STATUS_DATA_VALID as follows:

bool AD5933::getComplexData(int *real, int *imag) {
// ako, 2021-02-09: this while loop may hang! --> return if max requests exceeded
// Wait for a measurement to be available
int maxLoops = 1000;
while ((readStatusRegister() & STATUS_DATA_VALID) != STATUS_DATA_VALID) {
if(maxLoops > 0){
maxLoops--;
delay(1);
}
else
{
// timeout
*real = -1;
*imag = -1;
return false;
}
}
...

Would you consider incorporating this into the official release?
Best regards,
Adrian

@kitoheedong
Copy link

kitoheedong commented Nov 14, 2022

I am going through the same issue.
I am stuck at the while loop..
Everytime I re-start esp32, it' gets stuck at the same point..

Can you give me an advice?

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