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

mOnDuration value changes permanently, is it bug or feature? #22

Open
mrNo0b opened this issue Feb 5, 2023 · 0 comments
Open

mOnDuration value changes permanently, is it bug or feature? #22

mrNo0b opened this issue Feb 5, 2023 · 0 comments

Comments

@mrNo0b
Copy link

mrNo0b commented Feb 5, 2023

I use this library with ESP32 Devkit v1
I noticed that if I call EasyBuzzer.singleBeep(720, 600); for example, it will set beep duration to 600.
but then if I call EasyBuzzer.beep(420, 2); this should beep twice, but because I called the singleBeep before with duration of 600 now when I call beep it will also have duration of 600.
I don't know if its a bug or by design but I don't think its the correct/expected behavior...

Steps to reproduce:

  1. run beep function first - it should play for the default duration (100)
  2. run singleBeep function and set the duration parameter
  3. run beep function again - now it will have the duration that you set when called singleBeep

To quickly "fix" it I added this code:

  mOnDuration = DEFAULT_ON_DURATION;
  mOffDuration = DEFAULT_OFF_DURATION;
  mPauseDuration = DEFAULT_PAUSE_DURATION;

inside the if statement at

if (!sequenceDuration || (mSequences != 0 && elapsedTime / sequenceDuration >= mSequences))

I don't think its the best fix but it worked...

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

1 participant