From 94a796c8cc00bedd56a83ab27bc604cd5c629544 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 30 Jul 2015 23:19:11 -0700 Subject: [PATCH] Rename BEEPER to BEEPER_PIN For consistency with other pins, allowing use of `PIN_EXISTS` macro. --- Marlin/Conditionals.h | 2 +- Marlin/buzzer.cpp | 14 +++++++------- Marlin/pins_3DRAG.h | 6 +++--- Marlin/pins_AZTEEG_X3.h | 3 ++- Marlin/pins_AZTEEG_X3_PRO.h | 4 ++-- Marlin/pins_ELEFU_3.h | 2 +- Marlin/pins_GEN7_CUSTOM.h | 2 +- Marlin/pins_MEGACONTROLLER.h | 2 +- Marlin/pins_MEGATRONICS.h | 2 +- Marlin/pins_MEGATRONICS_2.h | 2 +- Marlin/pins_MEGATRONICS_3.h | 2 +- Marlin/pins_MINIRAMBO.h | 4 ++-- Marlin/pins_MINITRONICS.h | 3 +-- Marlin/pins_PRINTRBOARD.h | 4 ++-- Marlin/pins_RAMBO.h | 12 +++++++----- Marlin/pins_RAMPS_13.h | 15 ++++++++------- Marlin/pins_RIGIDBOARD.h | 8 ++++---- Marlin/pins_RUMBA.h | 2 +- Marlin/pins_SANGUINOLOLU_11.h | 6 +++--- Marlin/pins_SAV_MKI.h | 2 +- Marlin/pins_TEENSYLU.h | 5 +++-- Marlin/pins_ULTIMAIN_2.h | 3 +-- Marlin/pins_ULTIMAKER.h | 9 +++------ Marlin/ultralcd.cpp | 2 +- 24 files changed, 58 insertions(+), 58 deletions(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index 39ebfda3c..c21fc2feb 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -512,7 +512,7 @@ #define WRITE_FAN(v) WRITE(FAN_PIN, v) #endif - #define HAS_BUZZER ((defined(BEEPER) && BEEPER >= 0) || defined(LCD_USE_I2C_BUZZER)) + #define HAS_BUZZER (PIN_EXISTS(BEEPER) || defined(LCD_USE_I2C_BUZZER)) #if defined(NUM_SERVOS) && NUM_SERVOS > 0 #ifndef X_ENDSTOP_SERVO_NR diff --git a/Marlin/buzzer.cpp b/Marlin/buzzer.cpp index 6c3c37a57..a419cffbb 100644 --- a/Marlin/buzzer.cpp +++ b/Marlin/buzzer.cpp @@ -7,22 +7,22 @@ if (freq > 0) { #if ENABLED(LCD_USE_I2C_BUZZER) lcd_buzz(duration, freq); - #elif defined(BEEPER) && BEEPER >= 0 // on-board buzzers have no further condition - SET_OUTPUT(BEEPER); + #elif PIN_EXISTS(BEEPER) // on-board buzzers have no further condition + SET_OUTPUT(BEEPER_PIN); #ifdef SPEAKER // a speaker needs a AC ore a pulsed DC - //tone(BEEPER, freq, duration); // needs a PWMable pin + //tone(BEEPER_PIN, freq, duration); // needs a PWMable pin unsigned int delay = 1000000 / freq / 2; int i = duration * freq / 1000; while (i--) { - WRITE(BEEPER,HIGH); + WRITE(BEEPER_PIN, HIGH); delayMicroseconds(delay); - WRITE(BEEPER,LOW); + WRITE(BEEPER_PIN, LOW); delayMicroseconds(delay); } #else // buzzer has its own resonator - needs a DC - WRITE(BEEPER, HIGH); + WRITE(BEEPER_PIN, HIGH); delay(duration); - WRITE(BEEPER, LOW); + WRITE(BEEPER_PIN, LOW); #endif #else delay(duration); diff --git a/Marlin/pins_3DRAG.h b/Marlin/pins_3DRAG.h index bb8a20d89..26764720c 100644 --- a/Marlin/pins_3DRAG.h +++ b/Marlin/pins_3DRAG.h @@ -30,8 +30,8 @@ #define HEATER_BED_PIN 9 // BED #if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) - #undef BEEPER - #define BEEPER -1 + #undef BEEPER_PIN + #define BEEPER_PIN -1 #undef LCD_PINS_RS #undef LCD_PINS_ENABLE @@ -56,6 +56,6 @@ #else - #define BEEPER 33 + #define BEEPER_PIN 33 #endif // ULTRA_LCD && NEWPANEL diff --git a/Marlin/pins_AZTEEG_X3.h b/Marlin/pins_AZTEEG_X3.h index 087f52f6a..deca1b59e 100644 --- a/Marlin/pins_AZTEEG_X3.h +++ b/Marlin/pins_AZTEEG_X3.h @@ -8,7 +8,8 @@ #if ENABLED(VIKI2) || ENABLED(miniVIKI) - #define BEEPER 33 + #define BEEPER_PIN 33 + // Pins for DOGM SPI LCD Support #define DOGLCD_A0 31 #define DOGLCD_CS 32 diff --git a/Marlin/pins_AZTEEG_X3_PRO.h b/Marlin/pins_AZTEEG_X3_PRO.h index 78fd2caae..f2ffe475d 100644 --- a/Marlin/pins_AZTEEG_X3_PRO.h +++ b/Marlin/pins_AZTEEG_X3_PRO.h @@ -6,7 +6,7 @@ #undef FAN_PIN #define FAN_PIN 6 //Part Cooling System -#define BEEPER 33 +#define BEEPER_PIN 33 #define CONTROLLERFAN_PIN 4 //Pin used for the fan to cool motherboard (-1 to disable) //Fans/Water Pump to cool the hotend cool side. #define EXTRUDER_0_AUTO_FAN_PIN 5 @@ -97,7 +97,7 @@ //LCD Pins// #if ENABLED(VIKI2) || ENABLED(miniVIKI) - #define BEEPER 33 + #define BEEPER_PIN 33 // Pins for DOGM SPI LCD Support #define DOGLCD_A0 44 #define DOGLCD_CS 45 diff --git a/Marlin/pins_ELEFU_3.h b/Marlin/pins_ELEFU_3.h index 977a92b9c..20e6f2de6 100644 --- a/Marlin/pins_ELEFU_3.h +++ b/Marlin/pins_ELEFU_3.h @@ -53,7 +53,7 @@ #define TEMP_2_PIN 1 //ANALOG NUMBERING #define TEMP_BED_PIN 0 //ANALOG NUMBERING -#define BEEPER 36 +#define BEEPER_PIN 36 #define KILL_PIN -1 diff --git a/Marlin/pins_GEN7_CUSTOM.h b/Marlin/pins_GEN7_CUSTOM.h index a8626ecef..673632da3 100644 --- a/Marlin/pins_GEN7_CUSTOM.h +++ b/Marlin/pins_GEN7_CUSTOM.h @@ -56,7 +56,7 @@ //#define TX_ENABLE_PIN 12 //#define RX_ENABLE_PIN 13 -#define BEEPER -1 +#define BEEPER_PIN -1 #define SDCARDDETECT -1 #define SUICIDE_PIN -1 //has to be defined; otherwise Power_off doesn't work diff --git a/Marlin/pins_MEGACONTROLLER.h b/Marlin/pins_MEGACONTROLLER.h index ccca4d476..03ea94ee5 100644 --- a/Marlin/pins_MEGACONTROLLER.h +++ b/Marlin/pins_MEGACONTROLLER.h @@ -89,7 +89,7 @@ #endif #ifdef MINIPANEL - #define BEEPER 46 + #define BEEPER_PIN 46 // Pins for DOGM SPI LCD Support #define DOGLCD_A0 47 #define DOGLCD_CS 45 diff --git a/Marlin/pins_MEGATRONICS.h b/Marlin/pins_MEGATRONICS.h index 0ae3f4483..5b7e51823 100644 --- a/Marlin/pins_MEGATRONICS.h +++ b/Marlin/pins_MEGATRONICS.h @@ -58,7 +58,7 @@ #define HEATER_BED_PIN 10 // BED #define TEMP_BED_PIN 14 // ANALOG NUMBERING -#define BEEPER 33 // AUX-4 +#define BEEPER_PIN 33 // AUX-4 #if defined(ULTRA_LCD) && defined(NEWPANEL) diff --git a/Marlin/pins_MEGATRONICS_2.h b/Marlin/pins_MEGATRONICS_2.h index b05eaaa7a..e5c3a91be 100644 --- a/Marlin/pins_MEGATRONICS_2.h +++ b/Marlin/pins_MEGATRONICS_2.h @@ -74,7 +74,7 @@ #define TEMP_BED_PIN 14 // ANALOG NUMBERING #endif -#define BEEPER 64 +#define BEEPER_PIN 64 #define LCD_PINS_RS 14 diff --git a/Marlin/pins_MEGATRONICS_3.h b/Marlin/pins_MEGATRONICS_3.h index 5dac2bc7b..57f37b02f 100644 --- a/Marlin/pins_MEGATRONICS_3.h +++ b/Marlin/pins_MEGATRONICS_3.h @@ -76,7 +76,7 @@ #define TEMP_2_PIN (TEMP_SENSOR_2 == -1 ? 9 : 12) // ANALOG NUMBERING #define TEMP_BED_PIN (TEMP_SENSOR_BED == -1 ? 8 : 14) // ANALOG NUMBERING -#define BEEPER 61 +#define BEEPER_PIN 61 #define LCD_PINS_RS 32 #define LCD_PINS_ENABLE 31 diff --git a/Marlin/pins_MINIRAMBO.h b/Marlin/pins_MINIRAMBO.h index c93d324b7..bfc77c9fe 100644 --- a/Marlin/pins_MINIRAMBO.h +++ b/Marlin/pins_MINIRAMBO.h @@ -91,8 +91,8 @@ #if ENABLED(ULTRA_LCD) #define KILL_PIN 32 #if ENABLED(NEWPANEL) - //arduino pin which triggers an piezzo beeper - #define BEEPER 84 // Beeper on AUX-4 + + #define BEEPER_PIN 84 // Beeper on AUX-4 #define LCD_PINS_RS 82 #define LCD_PINS_ENABLE 18 #define LCD_PINS_D4 19 diff --git a/Marlin/pins_MINITRONICS.h b/Marlin/pins_MINITRONICS.h index eead2d455..ad613fb3b 100644 --- a/Marlin/pins_MINITRONICS.h +++ b/Marlin/pins_MINITRONICS.h @@ -59,8 +59,7 @@ #define HEATER_BED_PIN 3 // BED #define TEMP_BED_PIN 6 // ANALOG NUMBERING -#define BEEPER -1 - +#define BEEPER_PIN -1 #define LCD_PINS_RS -1 #define LCD_PINS_ENABLE -1 diff --git a/Marlin/pins_PRINTRBOARD.h b/Marlin/pins_PRINTRBOARD.h index de0fbc418..b68bf20bd 100644 --- a/Marlin/pins_PRINTRBOARD.h +++ b/Marlin/pins_PRINTRBOARD.h @@ -79,7 +79,7 @@ #if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) //we have no buzzer installed - #define BEEPER -1 + #define BEEPER_PIN -1 //LCD Pins #if ENABLED(LCD_I2C_PANELOLU2) #define BTN_EN1 27 //RX1 - fastio.h pin mapping 27 @@ -92,7 +92,7 @@ #endif // ULTRA_LCD && NEWPANEL #if ENABLED(VIKI2) || ENABLED(miniVIKI) - #define BEEPER 32 //FastIO + #define BEEPER_PIN 32 //FastIO // Pins for DOGM SPI LCD Support #define DOGLCD_A0 42 //Non-FastIO #define DOGLCD_CS 43 //Non-FastIO diff --git a/Marlin/pins_RAMBO.h b/Marlin/pins_RAMBO.h index 2ae4dcb78..651023042 100644 --- a/Marlin/pins_RAMBO.h +++ b/Marlin/pins_RAMBO.h @@ -112,8 +112,9 @@ #if ENABLED(ULTRA_LCD) #define KILL_PIN 80 #if ENABLED(NEWPANEL) - //arduino pin which triggers an piezzo beeper - #define BEEPER 79 // Beeper on AUX-4 + + #define BEEPER_PIN 79 // Beeper on AUX-4 + #define LCD_PINS_RS 70 #define LCD_PINS_ENABLE 71 #define LCD_PINS_D4 72 @@ -133,8 +134,9 @@ #define SDCARDDETECT 81 // Ramps does not use this port #else //!NEWPANEL - old style panel with shift register - //arduino pin witch triggers an piezzo beeper - #define BEEPER 33 No Beeper added + + #define BEEPER_PIN 33 // No Beeper added + //buttons are attached to a shift register // Not wired this yet // #define SHIFT_CLK 38 @@ -165,7 +167,7 @@ #endif // ULTRA_LCD #if ENABLED(VIKI2) || ENABLED(miniVIKI) - #define BEEPER 44 + #define BEEPER_PIN 44 // Pins for DOGM SPI LCD Support #define DOGLCD_A0 70 #define DOGLCD_CS 71 diff --git a/Marlin/pins_RAMPS_13.h b/Marlin/pins_RAMPS_13.h index db656b4f5..bc109efa0 100644 --- a/Marlin/pins_RAMPS_13.h +++ b/Marlin/pins_RAMPS_13.h @@ -159,7 +159,7 @@ #endif #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) - #define BEEPER 37 + #define BEEPER_PIN 37 #define BTN_EN1 31 #define BTN_EN2 33 @@ -186,12 +186,12 @@ #define SDCARDDETECT 49 #define LCD_SDSS 53 #define KILL_PIN 41 - #define BEEPER 23 + #define BEEPER_PIN 23 #define DOGLCD_CS 29 #define DOGLCD_A0 27 #define LCD_PIN_BL 33 #elif defined(MINIPANEL) - #define BEEPER 42 + #define BEEPER_PIN 42 // Pins for DOGM SPI LCD Support #define DOGLCD_A0 44 #define DOGLCD_CS 66 @@ -211,9 +211,10 @@ #define BTN_ENC 59 //the click switch //not connected to a pin #define SDCARDDETECT 49 + #else - // arduino pin which triggers an piezzo beeper - #define BEEPER 33 // Beeper on AUX-4 + + #define BEEPER_PIN 33 // Beeper on AUX-4 // buttons are directly attached using AUX-2 #if ENABLED(REPRAPWORLD_KEYPAD) @@ -241,8 +242,8 @@ #endif #else // !NEWPANEL (Old-style panel with shift register) - // Arduino pin to trigger a piezzo beeper - #define BEEPER 33 // No Beeper added + + #define BEEPER_PIN 33 // No Beeper added // Buttons are attached to a shift register // Not wired yet diff --git a/Marlin/pins_RIGIDBOARD.h b/Marlin/pins_RIGIDBOARD.h index ba653deb8..f7789c1da 100644 --- a/Marlin/pins_RIGIDBOARD.h +++ b/Marlin/pins_RIGIDBOARD.h @@ -22,8 +22,8 @@ #if ENABLED(RIGIDBOT_PANEL) - #undef BEEPER - #define BEEPER -1 + #undef BEEPER_PIN + #define BEEPER_PIN -1 #undef SDCARDDETECT #define SDCARDDETECT 22 @@ -48,8 +48,8 @@ #elif defined(REPRAP_DISCOUNT_SMART_CONTROLLER) - #undef BEEPER - #define BEEPER -1 + #undef BEEPER_PIN + #define BEEPER_PIN -1 #undef SDCARDDETECT #define SDCARDDETECT 22 diff --git a/Marlin/pins_RUMBA.h b/Marlin/pins_RUMBA.h index ce96d750d..a8f12aa50 100644 --- a/Marlin/pins_RUMBA.h +++ b/Marlin/pins_RUMBA.h @@ -102,7 +102,7 @@ #define SDPOWER -1 #define SDSS 53 #define SDCARDDETECT 49 -#define BEEPER 44 +#define BEEPER_PIN 44 #define LCD_PINS_RS 19 #define LCD_PINS_ENABLE 42 #define LCD_PINS_D4 18 diff --git a/Marlin/pins_SANGUINOLOLU_11.h b/Marlin/pins_SANGUINOLOLU_11.h index a98d46d30..184fa37ec 100644 --- a/Marlin/pins_SANGUINOLOLU_11.h +++ b/Marlin/pins_SANGUINOLOLU_11.h @@ -95,7 +95,7 @@ #if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) // No buzzer installed - #define BEEPER -1 + #define BEEPER_PIN -1 // LCD Pins #if ENABLED(DOGLCD) @@ -106,7 +106,7 @@ #define LCD_PINS_RS 30 //CS chip select /SS chip slave select #define LCD_PINS_ENABLE 29 //SID (MOSI) #define LCD_PINS_D4 17 //SCK (CLK) clock - #define BEEPER 27 // Pin 27 is take by LED_Pin, but Melzi LED do nothing with Marlin and I take this pin for BEEPER.... See here > [github.com] , If you want use this pin with Gcode M42 instead BEEPER + #define BEEPER_PIN 27 // Pin 27 is taken by LED_PIN, but Melzi LED does nothing with Marlin so this can be used for BEEPER_PIN. You can use this pin with M42 instead of BEEPER_PIN. #else // Sanguinololu 1.3 #define LCD_PINS_RS 4 #define LCD_PINS_ENABLE 17 @@ -160,7 +160,7 @@ #elif ENABLED(MAKRPANEL) - #define BEEPER 29 + #define BEEPER_PIN 29 // Pins for DOGM SPI LCD Support #define DOGLCD_A0 30 diff --git a/Marlin/pins_SAV_MKI.h b/Marlin/pins_SAV_MKI.h index 6a2ebb72a..f938e91a2 100644 --- a/Marlin/pins_SAV_MKI.h +++ b/Marlin/pins_SAV_MKI.h @@ -85,7 +85,7 @@ #define ALARM_PIN -1 #define SDCARDDETECT -1 -#define BEEPER -1 +#define BEEPER_PIN -1 #define LCD_PINS_RS -1 #define LCD_PINS_ENABLE -1 #define LCD_PINS_D4 -1 diff --git a/Marlin/pins_TEENSYLU.h b/Marlin/pins_TEENSYLU.h index 745100f16..997ca3c97 100644 --- a/Marlin/pins_TEENSYLU.h +++ b/Marlin/pins_TEENSYLU.h @@ -68,9 +68,10 @@ #endif #if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL) - //we have no buzzer installed - #define BEEPER -1 //LCD Pins + + #define BEEPER_PIN -1 + #if ENABLED(LCD_I2C_PANELOLU2) #define BTN_EN1 27 //RX1 - fastio.h pin mapping 27 #define BTN_EN2 26 //TX1 - fastio.h pin mapping 26 diff --git a/Marlin/pins_ULTIMAIN_2.h b/Marlin/pins_ULTIMAIN_2.h index 7c03f6b2b..46d8ee2a6 100644 --- a/Marlin/pins_ULTIMAIN_2.h +++ b/Marlin/pins_ULTIMAIN_2.h @@ -58,8 +58,7 @@ #define MOTOR_CURRENT_PWM_RANGE 2000 #define DEFAULT_PWM_MOTOR_CURRENT {1300, 1300, 1250} -//arduino pin witch triggers an piezzo beeper -#define BEEPER 18 +#define BEEPER_PIN 18 #define LCD_PINS_RS 20 #define LCD_PINS_ENABLE 15 diff --git a/Marlin/pins_ULTIMAKER.h b/Marlin/pins_ULTIMAKER.h index bb6e01dae..9f0bb18c8 100644 --- a/Marlin/pins_ULTIMAKER.h +++ b/Marlin/pins_ULTIMAKER.h @@ -57,9 +57,9 @@ #if ENABLED(ULTRA_LCD) + #define BEEPER_PIN 18 + #if ENABLED(NEWPANEL) - //arduino pin witch triggers an piezzo beeper - #define BEEPER 18 #define LCD_PINS_RS 20 #define LCD_PINS_ENABLE 17 @@ -71,15 +71,12 @@ //buttons are directly attached #define BTN_EN1 40 #define BTN_EN2 42 - #define BTN_ENC 19 //the click + #define BTN_ENC 19 #define SDCARDDETECT 38 #else //!NEWPANEL - Old style panel with shift register - //arduino pin witch triggers an piezzo beeper - #define BEEPER 18 - //buttons are attached to a shift register #define SHIFT_CLK 38 #define SHIFT_LD 42 diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 88e60de71..fa47947b9 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1325,7 +1325,7 @@ void lcd_quick_feedback() { #define LCD_FEEDBACK_FREQUENCY_DURATION_MS (1000/6) #endif lcd.buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); - #elif defined(BEEPER) && BEEPER >= 0 + #elif PIN_EXISTS(BEEPER) #ifndef LCD_FEEDBACK_FREQUENCY_HZ #define LCD_FEEDBACK_FREQUENCY_HZ 5000 #endif