Rework buzzing (PR#2296)
by: Moving HAS_LCD_BUZZ macro to Coditionals.h Renaming HAS_LCD_BUZZ to HAS_BUZZER to make clear is has nothing to do with the lcd. Removing the ULTRALCD condition. Moving declaration of lcd_buzz() out of the ULTRA_LCD block in ultralcd.h Moving definition of lcd_buzz() out of the ULTIPANEL block in ultralcd.cpp Renaming lcd_buzz() to buzz() to make clear is has nothing to do with the lcd. All buzzing code is now only dependent on the existence of a BEEPER-pin or the definition of a LCD_USE_I2C_BUZZER. To do: Check the conditions for the BEEPER-pin in all pin-files.
This commit is contained in:
committed by
Richard Wackerbarth
parent
29122db2fa
commit
6ab7b560af
@ -1313,7 +1313,7 @@ void lcd_quick_feedback() {
|
||||
#ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
|
||||
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS (1000/6)
|
||||
#endif
|
||||
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
|
||||
buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
|
||||
#elif defined(BEEPER) && BEEPER >= 0
|
||||
#ifndef LCD_FEEDBACK_FREQUENCY_HZ
|
||||
#define LCD_FEEDBACK_FREQUENCY_HZ 5000
|
||||
@ -1321,7 +1321,7 @@ void lcd_quick_feedback() {
|
||||
#ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
|
||||
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
|
||||
#endif
|
||||
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
|
||||
buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
|
||||
#else
|
||||
#ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
|
||||
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
|
||||
@ -1745,7 +1745,12 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
|
||||
#endif
|
||||
}
|
||||
|
||||
void lcd_buzz(long duration, uint16_t freq) {
|
||||
bool lcd_clicked() { return LCD_CLICKED; }
|
||||
|
||||
#endif // ULTIPANEL
|
||||
|
||||
#if HAS_BUZZER
|
||||
void buzz(long duration, uint16_t freq) {
|
||||
if (freq > 0) {
|
||||
#ifdef LCD_USE_I2C_BUZZER
|
||||
lcd.buzz(duration, freq);
|
||||
@ -1761,10 +1766,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
|
||||
delay(duration);
|
||||
}
|
||||
}
|
||||
|
||||
bool lcd_clicked() { return LCD_CLICKED; }
|
||||
|
||||
#endif // ULTIPANEL
|
||||
#endif
|
||||
|
||||
/*********************************/
|
||||
/** Number to string conversion **/
|
||||
|
Reference in New Issue
Block a user