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

Fix crash when calling tone() with frequency 0 #520

Merged
merged 2 commits into from
May 11, 2020

Conversation

adriaanb
Copy link
Contributor

@adriaanb adriaanb commented May 10, 2020

Avoid division by 0 when a frequency of 0 is passed to tone(). If a 0 is passed, noTone() is called instead. Fixes #519

Avoid division by 0 when a frequency of 0 is passed to the tone() function. If a 0 is passed, noTone() is called instead.
@facchinm facchinm merged commit 46f6cad into arduino:master May 11, 2020
@facchinm
Copy link
Member

Merged, thanks!

@adriaanb adriaanb deleted the bugfix-tone branch May 13, 2020 21:56
@adriaanb adriaanb restored the bugfix-tone branch May 13, 2020 21:58
giulcioffi pushed a commit to giulcioffi/ArduinoCore-samd that referenced this pull request May 21, 2020
Avoid division by 0 when a frequency of 0 is passed to the tone() function. If a 0 is passed, noTone() is called instead.
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.

tone() causes division by zero and gets stuck in infinite loop if frequency is 0
2 participants