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

ESP32 core panic #4

Open
lodesmets opened this issue Feb 6, 2022 · 4 comments
Open

ESP32 core panic #4

lodesmets opened this issue Feb 6, 2022 · 4 comments

Comments

@lodesmets
Copy link

Hey, I tried your code, but it kept crashing. After some research it seems that the problem is with _dir.

According to this, you aren't allowed to do float arithmetic in an interupt.
void WeatherMeters::timer() gets called on interrupt. And void WeatherMeters::timer() calls float WeatherMeters::adcToDir(uint16_t value)

@pilotak
Copy link
Owner

pilotak commented Feb 8, 2022

Thanks for finding a bug, according to the issue the easiest fix is to make _dir double instead of float. Can you please test it? perhaps submitting a PR?

lodesmets added a commit to lodesmets/MovingAverageAngle that referenced this issue Feb 8, 2022
Changed float to double (see pilotak/WeatherMeters#4)
lodesmets added a commit to lodesmets/WeatherMeters that referenced this issue Feb 8, 2022
Changed float to double (see pilotak#4)
@lodesmets
Copy link
Author

I tested it, and did a pull request both here and in pilotak/MovingAverageAngle#2 (that one also uses floats)

Thanks btw for the great library

@pilotak
Copy link
Owner

pilotak commented Feb 9, 2022

ok i didn't realise this will also affect the MovingAverageAngle library (perfect investigation 👍) which i want to keep with floats due to FPU which leads me to an idea - I can easilly adjust the example for timers to bring the timer() function to main loop which would solve the problem. What do you think?

@lodesmets
Copy link
Author

That is indeed the way I have done it now

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