Two strategies to address a stuck buzzer

master
Scott Lahteine 8 years ago
parent 0ccc5d1dd9
commit 71674059c3

@ -124,7 +124,7 @@ class Buzzer {
this->state.timestamp = millis() + this->state.tone.duration; this->state.timestamp = millis() + this->state.tone.duration;
if (this->state.tone.frequency > 0) this->on(); if (this->state.tone.frequency > 0) this->on();
} }
else if (millis() >= this->state.timestamp) this->reset(); else if (ELAPSED(millis(), this->state.timestamp)) this->reset();
} }
}; };

@ -2334,12 +2334,14 @@ void kill_screen(const char* lcd_msg) {
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
next_button_update_ms = millis() + 500; next_button_update_ms = millis() + 500;
// Buzz and wait. The delay is needed for buttons to settle!
#if ENABLED(LCD_USE_I2C_BUZZER) #if ENABLED(LCD_USE_I2C_BUZZER)
lcd.buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); lcd.buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
delay(10);
#elif PIN_EXISTS(BEEPER) #elif PIN_EXISTS(BEEPER)
buzzer.tone(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); buzzer.tone(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); }
#endif #endif
delay(10); // needed for buttons to settle
} }
/** /**

Loading…
Cancel
Save