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) #if defined(ARDUINO_ARCH_ESP32)
ledcDetachPin(ESP3D_BUZZER_PIN); ledcDetachPin(ESP3D_BUZZER_PIN);
#endif //ARDUINO_ARCH_ESP32 #endif //ARDUINO_ARCH_ESP32
no_tone();
} }
@ -90,6 +91,7 @@ void BuzzerDevice::handle()
void BuzzerDevice::beep(int count, int delay, int frequency) void BuzzerDevice::beep(int count, int delay, int frequency)
{ {
if (_started) {
while (count > 0) { while (count > 0) {
playsound(frequency,BEEP_DURATION); playsound(frequency,BEEP_DURATION);
if (delay > 0 ) { if (delay > 0 ) {
@ -98,6 +100,7 @@ void BuzzerDevice::beep(int count, int delay, int frequency)
waitWhilePlaying(); waitWhilePlaying();
count--; count--;
} }
}
} }
void BuzzerDevice::no_tone() void BuzzerDevice::no_tone()