Skip to content

Compatibility and IRQ fixed for waveform/tone/pwm #4872

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

Merged
merged 3 commits into from
Jul 2, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix tone(int,int,int) infinite loop
Explicitly cast the frequency, when passed in as an int, to an
unsigned int.  Verified with snippet:
  tone(D1, (int)1000, 500);
  tone(D1, (unsigned int)1000, 500);
  tone(D1, 1000.0, 500);
  tone(D1, (int)1000);
  tone(D1, (unsigned int)1000);
  tone(D1, 1000.0);
  • Loading branch information
earlephilhower committed Jul 2, 2018
commit a812e2760c7ec3b422b3bb38f126d9960448212b
3 changes: 2 additions & 1 deletion cores/esp8266/Tone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ void tone(uint8_t _pin, double frequency, unsigned long duration) {

// Fix ambiguous tone() binding when adding in a duration
void tone(uint8_t _pin, int frequency, unsigned long duration) {
tone(_pin, frequency, duration);
// Call the unsigned int version of the function explicitly
tone(_pin, (unsigned int)frequency, duration);
}


Expand Down