mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-27 13:56:24 +00:00
Add lcd_buzz function to ultralcd.h so that non-LCD code can make use of lcd's buzzer.
Argument order of lcd_buzz was set to mirror that on tone(). Change default M300 frequency to something audible.
This commit is contained in:
parent
788d62bcc4
commit
7f57f28ccc
@ -1446,16 +1446,20 @@ void process_commands()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined(LARGE_FLASH) && LARGE_FLASH == true && defined(BEEPER) && BEEPER > -1
|
#if defined(LARGE_FLASH) && LARGE_FLASH == true
|
||||||
case 300: // M300
|
case 300: // M300
|
||||||
{
|
{
|
||||||
int beepS = 1;
|
int beepS = 400;
|
||||||
int beepP = 1000;
|
int beepP = 1000;
|
||||||
if(code_seen('S')) beepS = code_value();
|
if(code_seen('S')) beepS = code_value();
|
||||||
if(code_seen('P')) beepP = code_value();
|
if(code_seen('P')) beepP = code_value();
|
||||||
tone(BEEPER, beepS);
|
#if defined(BEEPER) && BEEPER > -1
|
||||||
delay(beepP);
|
tone(BEEPER, beepS);
|
||||||
noTone(BEEPER);
|
delay(beepP);
|
||||||
|
noTone(BEEPER);
|
||||||
|
#elif defined(ULTRALCD)
|
||||||
|
lcd_buzz(beepS, beepP);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif // M300
|
#endif // M300
|
||||||
@ -1672,17 +1676,19 @@ void process_commands()
|
|||||||
manage_inactivity();
|
manage_inactivity();
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
|
||||||
#if BEEPER > -1
|
|
||||||
if(cnt==0)
|
if(cnt==0)
|
||||||
{
|
{
|
||||||
|
#if defined(BEEPER) && BEEPER > -1
|
||||||
SET_OUTPUT(BEEPER);
|
SET_OUTPUT(BEEPER);
|
||||||
|
|
||||||
WRITE(BEEPER,HIGH);
|
WRITE(BEEPER,HIGH);
|
||||||
delay(3);
|
delay(3);
|
||||||
WRITE(BEEPER,LOW);
|
WRITE(BEEPER,LOW);
|
||||||
delay(3);
|
delay(3);
|
||||||
}
|
#else
|
||||||
|
lcd_buzz(1000/6,100);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//return to normal
|
//return to normal
|
||||||
|
@ -946,6 +946,13 @@ void lcd_buttons_update()
|
|||||||
lastEncoderBits = enc;
|
lastEncoderBits = enc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lcd_buzz(long duration, uint16_t freq)
|
||||||
|
{
|
||||||
|
#ifdef LCD_USE_I2C_BUZZER
|
||||||
|
lcd.buzz(duration,freq);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool lcd_clicked()
|
bool lcd_clicked()
|
||||||
{
|
{
|
||||||
return LCD_CLICKED;
|
return LCD_CLICKED;
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
extern int absPreheatHPBTemp;
|
extern int absPreheatHPBTemp;
|
||||||
extern int absPreheatFanSpeed;
|
extern int absPreheatFanSpeed;
|
||||||
|
|
||||||
|
void lcd_buzz(long duration,uint16_t freq);
|
||||||
|
|
||||||
bool lcd_clicked();
|
bool lcd_clicked();
|
||||||
|
|
||||||
#else //no lcd
|
#else //no lcd
|
||||||
@ -42,6 +44,7 @@
|
|||||||
FORCE_INLINE void lcd_setstatus(const char* message) {}
|
FORCE_INLINE void lcd_setstatus(const char* message) {}
|
||||||
FORCE_INLINE void lcd_buttons_update() {}
|
FORCE_INLINE void lcd_buttons_update() {}
|
||||||
FORCE_INLINE void lcd_reset_alert_level() {}
|
FORCE_INLINE void lcd_reset_alert_level() {}
|
||||||
|
FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {}
|
||||||
|
|
||||||
#define LCD_MESSAGEPGM(x)
|
#define LCD_MESSAGEPGM(x)
|
||||||
#define LCD_ALERTMESSAGEPGM(x)
|
#define LCD_ALERTMESSAGEPGM(x)
|
||||||
|
Loading…
Reference in New Issue
Block a user