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:
AnHardt
2015-06-15 00:12:02 +02:00
committed by Richard Wackerbarth
parent 29122db2fa
commit 6ab7b560af
4 changed files with 22 additions and 18 deletions

View File

@@ -36,7 +36,6 @@
#endif
#endif // ENABLE_AUTO_BED_LEVELING
#define HAS_LCD_BUZZ (defined(ULTRA_LCD) || (defined(BEEPER) && BEEPER >= 0) || defined(LCD_USE_I2C_BUZZER))
#define SERVO_LEVELING (defined(ENABLE_AUTO_BED_LEVELING) && PROBE_SERVO_DEACTIVATION_DELAY > 0)
#ifdef MESH_BED_LEVELING
@@ -4349,7 +4348,7 @@ inline void gcode_M226() {
#endif // NUM_SERVOS > 0
#if HAS_LCD_BUZZ
#if HAS_BUZZER
/**
* M300: Play beep sound S<frequency Hz> P<duration ms>
@@ -4358,10 +4357,10 @@ inline void gcode_M226() {
uint16_t beepS = code_seen('S') ? code_value_short() : 110;
uint32_t beepP = code_seen('P') ? code_value_long() : 1000;
if (beepP > 5000) beepP = 5000; // limit to 5 seconds
lcd_buzz(beepP, beepS);
buzz(beepP, beepS);
}
#endif // HAS_LCD_BUZZ
#endif // HAS_BUZZER
#ifdef PIDTEMP
@@ -4791,7 +4790,7 @@ inline void gcode_M428() {
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_ERR_M428_TOO_FAR);
LCD_ALERTMESSAGEPGM("Err: Too far!");
#if HAS_LCD_BUZZ
#if HAS_BUZZER
enqueuecommands_P(PSTR("M300 S40 P200"));
#endif
err = true;
@@ -4805,7 +4804,7 @@ inline void gcode_M428() {
memcpy(home_offset, new_offs, sizeof(new_offs));
sync_plan_position();
LCD_ALERTMESSAGEPGM("Offset applied.");
#if HAS_LCD_BUZZ
#if HAS_BUZZER
enqueuecommands_P(PSTR("M300 S659 P200\nM300 S698 P200"));
#endif
}
@@ -5607,11 +5606,11 @@ void process_next_command() {
break;
#endif // NUM_SERVOS > 0
#if HAS_LCD_BUZZ
#if HAS_BUZZER
case 300: // M300 - Play beep tone
gcode_M300();
break;
#endif // HAS_LCD_BUZZ
#endif // HAS_BUZZER
#ifdef PIDTEMP
case 301: // M301