Update buzzer.cpp

This commit is contained in:
Luc 2019-08-05 14:48:26 +02:00
parent 4961ff9902
commit 7bc15e1bd9

View File

@ -80,6 +80,7 @@ void BuzzerDevice::end()
#if defined(ARDUINO_ARCH_ESP32)
ledcDetachPin(ESP3D_BUZZER_PIN);
#endif //ARDUINO_ARCH_ESP32
no_tone();
}
@ -90,13 +91,15 @@ void BuzzerDevice::handle()
void BuzzerDevice::beep(int count, int delay, int frequency)
{
while (count > 0) {
playsound(frequency,BEEP_DURATION);
if (delay > 0 ) {
playsound(0,delay);
if (_started) {
while (count > 0) {
playsound(frequency,BEEP_DURATION);
if (delay > 0 ) {
playsound(0,delay);
}
waitWhilePlaying();
count--;
}
waitWhilePlaying();
count--;
}
}