@ -1131,23 +1131,18 @@ void lcd_quick_feedback() {
# endif
# endif
lcd_buzz ( LCD_FEEDBACK_FREQUENCY_DURATION_MS , LCD_FEEDBACK_FREQUENCY_HZ ) ;
lcd_buzz ( LCD_FEEDBACK_FREQUENCY_DURATION_MS , LCD_FEEDBACK_FREQUENCY_HZ ) ;
# elif defined(BEEPER) && BEEPER > -1
# elif defined(BEEPER) && BEEPER > -1
SET_OUTPUT ( BEEPER ) ;
# ifndef LCD_FEEDBACK_FREQUENCY_HZ
# ifndef LCD_FEEDBACK_FREQUENCY_HZ
# define LCD_FEEDBACK_FREQUENCY_HZ 5000
# define LCD_FEEDBACK_FREQUENCY_HZ 5000
# endif
# endif
# ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
# ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
# define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
# define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
# endif
# endif
const uint16_t delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2 ;
lcd_buzz ( LCD_FEEDBACK_FREQUENCY_DURATION_MS , LCD_FEEDBACK_FREQUENCY_HZ ) ;
uint16_t i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000 ;
# else
while ( i - - ) {
# ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
WRITE ( BEEPER , HIGH ) ;
# define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
delayMicroseconds ( delay ) ;
# endif
WRITE ( BEEPER , LOW ) ;
delay ( LCD_FEEDBACK_FREQUENCY_DURATION_MS ) ;
delayMicroseconds ( delay ) ;
}
const uint16_t j = max ( 10000 - LCD_FEEDBACK_FREQUENCY_DURATION_MS * 1000 , 0 ) ;
if ( j ) delayMicroseconds ( j ) ;
# endif
# endif
}
}
@ -1544,10 +1539,22 @@ bool lcd_detected(void) {
}
}
void lcd_buzz ( long duration , uint16_t freq ) {
void lcd_buzz ( long duration , uint16_t freq ) {
# ifdef LCD_USE_I2C_BUZZER
if ( freq > 0 ) {
# if BEEPER > 0
SET_OUTPUT ( BEEPER ) ;
tone ( BEEPER , freq ) ;
delay ( duration ) ;
noTone ( BEEPER ) ;
# elif defined(LCD_USE_I2C_BUZZER)
lcd . buzz ( duration , freq ) ;
lcd . buzz ( duration , freq ) ;
# else
delay ( duration ) ;
# endif
# endif
}
}
else {
delay ( duration ) ;
}
}
bool lcd_clicked ( ) { return LCD_CLICKED ; }
bool lcd_clicked ( ) { return LCD_CLICKED ; }