From 8d3b74cc6e2905e5bffe1f47b48b96f67a9d1634 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 31 Jul 2015 15:09:36 -0700 Subject: [PATCH] Rename SDCARDDETECT to SDCARDDETECT_PIN - Rename the pin so it can be tested with `PIN_EXISTS` - Fix some incorrect tests for `SDCARDDETECT` --- Marlin/cardreader.h | 6 +++--- Marlin/pins_AZTEEG_X3_PRO.h | 2 +- Marlin/pins_BRAINWAVE_PRO.h | 2 +- Marlin/pins_CHEAPTRONIC.h | 2 +- Marlin/pins_ELEFU_3.h | 2 +- Marlin/pins_FELIX2.h | 2 +- Marlin/pins_GEN7_CUSTOM.h | 2 +- Marlin/pins_LEAPFROG.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 | 2 +- Marlin/pins_MINITRONICS.h | 2 +- Marlin/pins_OMCA.h | 2 +- Marlin/pins_OMCA_A.h | 2 +- Marlin/pins_PRINTRBOARD.h | 4 ++-- Marlin/pins_RAMBO.h | 4 ++-- Marlin/pins_RAMPS_13.h | 14 +++++++------- Marlin/pins_RIGIDBOARD.h | 12 ++++++------ Marlin/pins_RUMBA.h | 2 +- Marlin/pins_SANGUINOLOLU_11.h | 4 ++-- Marlin/pins_SAV_MKI.h | 2 +- Marlin/pins_TEENSY2.h | 2 +- Marlin/pins_TEENSYLU.h | 2 +- Marlin/pins_ULTIMAIN_2.h | 2 +- Marlin/pins_ULTIMAKER.h | 4 ++-- Marlin/ultralcd.cpp | 20 ++++++++++---------- 28 files changed, 54 insertions(+), 54 deletions(-) diff --git a/Marlin/cardreader.h b/Marlin/cardreader.h index 2d4029e47c..07faabd883 100644 --- a/Marlin/cardreader.h +++ b/Marlin/cardreader.h @@ -81,11 +81,11 @@ extern CardReader card; #define IS_SD_PRINTING (card.sdprinting) -#if (SDCARDDETECT > -1) +#if PIN_EXISTS(SDCARDDETECT) #if ENABLED(SDCARDDETECTINVERTED) - #define IS_SD_INSERTED (READ(SDCARDDETECT) != 0) + #define IS_SD_INSERTED (READ(SDCARDDETECT_PIN) != 0) #else - #define IS_SD_INSERTED (READ(SDCARDDETECT) == 0) + #define IS_SD_INSERTED (READ(SDCARDDETECT_PIN) == 0) #endif #else //No card detect line? Assume the card is inserted. diff --git a/Marlin/pins_AZTEEG_X3_PRO.h b/Marlin/pins_AZTEEG_X3_PRO.h index f2ffe475d9..7e2c0a488a 100644 --- a/Marlin/pins_AZTEEG_X3_PRO.h +++ b/Marlin/pins_AZTEEG_X3_PRO.h @@ -109,7 +109,7 @@ #define BTN_ENC 39 //the click switch #define SDSS 53 - #define SDCARDDETECT 49 + #define SDCARDDETECT_PIN 49 #define KILL_PIN 31 #endif diff --git a/Marlin/pins_BRAINWAVE_PRO.h b/Marlin/pins_BRAINWAVE_PRO.h index a870cbeb94..b27aa362aa 100644 --- a/Marlin/pins_BRAINWAVE_PRO.h +++ b/Marlin/pins_BRAINWAVE_PRO.h @@ -54,7 +54,7 @@ #define PS_ON_PIN -1 #define KILL_PIN -1 #define ALARM_PIN -1 -#define SDCARDDETECT 12 +#define SDCARDDETECT_PIN 12 #if DISABLED(SDSUPPORT) // these pins are defined in the SD library if building with SD support diff --git a/Marlin/pins_CHEAPTRONIC.h b/Marlin/pins_CHEAPTRONIC.h index dbf53a7e2e..72ee63bd68 100644 --- a/Marlin/pins_CHEAPTRONIC.h +++ b/Marlin/pins_CHEAPTRONIC.h @@ -86,4 +86,4 @@ #define BLEN_A 0 // Cheaptronic v1.0 does not use this port -#define SDCARDDETECT -1 +#define SDCARDDETECT_PIN -1 diff --git a/Marlin/pins_ELEFU_3.h b/Marlin/pins_ELEFU_3.h index f581f287c7..55b44bf275 100644 --- a/Marlin/pins_ELEFU_3.h +++ b/Marlin/pins_ELEFU_3.h @@ -64,7 +64,7 @@ #if ENABLED(RA_CONTROL_PANEL) #define SDSS 53 - #define SDCARDDETECT 28 + #define SDCARDDETECT_PIN 28 #define BTN_EN1 14 #define BTN_EN2 39 diff --git a/Marlin/pins_FELIX2.h b/Marlin/pins_FELIX2.h index 6f7394e52b..d345c37c99 100644 --- a/Marlin/pins_FELIX2.h +++ b/Marlin/pins_FELIX2.h @@ -19,6 +19,6 @@ #define BLEN_C 2 #define BLEN_B 1 #define BLEN_A 0 - #define SDCARDDETECT 6 + #define SDCARDDETECT_PIN 6 #endif // NEWPANEL && ULTRA_LCD diff --git a/Marlin/pins_GEN7_CUSTOM.h b/Marlin/pins_GEN7_CUSTOM.h index 673632da30..9c489d15a4 100644 --- a/Marlin/pins_GEN7_CUSTOM.h +++ b/Marlin/pins_GEN7_CUSTOM.h @@ -57,7 +57,7 @@ //#define RX_ENABLE_PIN 13 #define BEEPER_PIN -1 -#define SDCARDDETECT -1 +#define SDCARDDETECT_PIN -1 #define SUICIDE_PIN -1 //has to be defined; otherwise Power_off doesn't work #define KILL_PIN -1 diff --git a/Marlin/pins_LEAPFROG.h b/Marlin/pins_LEAPFROG.h index 52ca619399..45cf6bde4f 100644 --- a/Marlin/pins_LEAPFROG.h +++ b/Marlin/pins_LEAPFROG.h @@ -42,7 +42,7 @@ #define SDPOWER -1 #define SDSS 11 -#define SDCARDDETECT -1 // 10 optional also used as mode pin +#define SDCARDDETECT_PIN -1 // 10 optional also used as mode pin #define LED_PIN 13 #define FAN_PIN 7 #define PS_ON_PIN -1 diff --git a/Marlin/pins_MEGACONTROLLER.h b/Marlin/pins_MEGACONTROLLER.h index 03ea94ee5b..aa39c39204 100644 --- a/Marlin/pins_MEGACONTROLLER.h +++ b/Marlin/pins_MEGACONTROLLER.h @@ -107,6 +107,6 @@ #define BTN_EN2 11 #define BTN_ENC 10 //the click switch //not connected to a pin - #define SDCARDDETECT 49 + #define SDCARDDETECT_PIN 49 #endif //Minipanel diff --git a/Marlin/pins_MEGATRONICS.h b/Marlin/pins_MEGATRONICS.h index 5b7e518236..82b6e8175d 100644 --- a/Marlin/pins_MEGATRONICS.h +++ b/Marlin/pins_MEGATRONICS.h @@ -78,6 +78,6 @@ #define BLEN_B 1 #define BLEN_A 0 - #define SDCARDDETECT -1 // RAMPS doesn't use this + #define SDCARDDETECT_PIN -1 // RAMPS doesn't use this #endif // ULTRA_LCD && NEWPANEL diff --git a/Marlin/pins_MEGATRONICS_2.h b/Marlin/pins_MEGATRONICS_2.h index e5c3a91bee..8f9046c498 100644 --- a/Marlin/pins_MEGATRONICS_2.h +++ b/Marlin/pins_MEGATRONICS_2.h @@ -94,4 +94,4 @@ #define BLEN_B 1 #define BLEN_A 0 -#define SDCARDDETECT -1 // Megatronics does not use this port +#define SDCARDDETECT_PIN -1 // Megatronics does not use this port diff --git a/Marlin/pins_MEGATRONICS_3.h b/Marlin/pins_MEGATRONICS_3.h index 57f37b02fd..e0bea57d50 100644 --- a/Marlin/pins_MEGATRONICS_3.h +++ b/Marlin/pins_MEGATRONICS_3.h @@ -99,4 +99,4 @@ #define BLEN_B 1 #define BLEN_A 0 -#define SDCARDDETECT -1 // Megatronics does not use this port +#define SDCARDDETECT_PIN -1 // Megatronics does not use this port diff --git a/Marlin/pins_MINIRAMBO.h b/Marlin/pins_MINIRAMBO.h index 8e12cf2a7a..9732e342f5 100644 --- a/Marlin/pins_MINIRAMBO.h +++ b/Marlin/pins_MINIRAMBO.h @@ -107,7 +107,7 @@ #define BTN_EN2 72 #define BTN_ENC 9 // the click - #define SDCARDDETECT 15 + #define SDCARDDETECT_PIN 15 #endif //NEWPANEL #endif //ULTRA_LCD diff --git a/Marlin/pins_MINITRONICS.h b/Marlin/pins_MINITRONICS.h index ad613fb3b0..4fc35b93e6 100644 --- a/Marlin/pins_MINITRONICS.h +++ b/Marlin/pins_MINITRONICS.h @@ -78,4 +78,4 @@ #define BLEN_B 1 #define BLEN_A 0 -#define SDCARDDETECT -1 // Megatronics does not use this port +#define SDCARDDETECT_PIN -1 // Minitronics does not use this port diff --git a/Marlin/pins_OMCA.h b/Marlin/pins_OMCA.h index 91efbd295f..173177f8ca 100644 --- a/Marlin/pins_OMCA.h +++ b/Marlin/pins_OMCA.h @@ -70,7 +70,7 @@ #define SDPOWER -1 #define SDSS 11 -#define SDCARDDETECT -1 // 10 optional also used as mode pin +#define SDCARDDETECT_PIN -1 // 10 optional also used as mode pin #define LED_PIN -1 #define FAN_PIN 14 // PWM on MIDDLE connector #define PS_ON_PIN -1 diff --git a/Marlin/pins_OMCA_A.h b/Marlin/pins_OMCA_A.h index 857ff7752f..f66de1ff4f 100644 --- a/Marlin/pins_OMCA_A.h +++ b/Marlin/pins_OMCA_A.h @@ -61,7 +61,7 @@ #define SDPOWER -1 #define SDSS 11 -#define SDCARDDETECT -1 // 10 optional also used as mode pin +#define SDCARDDETECT_PIN -1 // 10 optional also used as mode pin #define LED_PIN -1 #define FAN_PIN 3 #define PS_ON_PIN -1 diff --git a/Marlin/pins_PRINTRBOARD.h b/Marlin/pins_PRINTRBOARD.h index b68bf20bde..ff81cfee95 100644 --- a/Marlin/pins_PRINTRBOARD.h +++ b/Marlin/pins_PRINTRBOARD.h @@ -88,7 +88,7 @@ #define SDSS 40 //use SD card on Panelolu2 (Teensyduino pin mapping) #endif // LCD_I2C_PANELOLU2 //not connected to a pin - #define SDCARDDETECT -1 + #define SDCARDDETECT_PIN -1 #endif // ULTRA_LCD && NEWPANEL #if ENABLED(VIKI2) || ENABLED(miniVIKI) @@ -104,7 +104,7 @@ #define BTN_ENC 47 //the click switch #define SDSS 45 - #define SDCARDDETECT -1 // FastIO (Manual says 72 I'm not certain cause I can't test) + #define SDCARDDETECT_PIN -1 // FastIO (Manual says 72 I'm not certain cause I can't test) #if ENABLED(TEMP_STAT_LEDS) #define STAT_LED_RED 12 //Non-FastIO diff --git a/Marlin/pins_RAMBO.h b/Marlin/pins_RAMBO.h index 57b7a68413..2600c36e80 100644 --- a/Marlin/pins_RAMBO.h +++ b/Marlin/pins_RAMBO.h @@ -133,7 +133,7 @@ #define BLEN_B 1 #define BLEN_A 0 - #define SDCARDDETECT 81 // Ramps does not use this port + #define SDCARDDETECT_PIN 81 // Ramps doesn't use this port #else //!NEWPANEL - old style panel with shift register @@ -180,7 +180,7 @@ #define BTN_EN2 84 #define BTN_ENC 83 //the click switch - #define SDCARDDETECT -1 // Pin 72 if using easy adapter board + #define SDCARDDETECT_PIN -1 // Pin 72 if using easy adapter board #if ENABLED(TEMP_STAT_LEDS) #define STAT_LED_RED 22 diff --git a/Marlin/pins_RAMPS_13.h b/Marlin/pins_RAMPS_13.h index bc109efa09..67ca166ba1 100644 --- a/Marlin/pins_RAMPS_13.h +++ b/Marlin/pins_RAMPS_13.h @@ -165,25 +165,25 @@ #define BTN_EN2 33 #define BTN_ENC 35 - #define SDCARDDETECT 49 + #define SDCARDDETECT_PIN 49 #elif ENABLED(LCD_I2C_PANELOLU2) #define BTN_EN1 47 // reverse if the encoder turns the wrong way. #define BTN_EN2 43 #define BTN_ENC 32 #define LCD_SDSS 53 - #define SDCARDDETECT -1 + #define SDCARDDETECT_PIN -1 #define KILL_PIN 41 #elif ENABLED(LCD_I2C_VIKI) #define BTN_EN1 22 // reverse if the encoder turns the wrong way. #define BTN_EN2 7 #define BTN_ENC -1 #define LCD_SDSS 53 - #define SDCARDDETECT 49 + #define SDCARDDETECT_PIN 49 #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) #define BTN_EN1 35 // reverse if the encoder turns the wrong way. #define BTN_EN2 37 #define BTN_ENC 31 - #define SDCARDDETECT 49 + #define SDCARDDETECT_PIN 49 #define LCD_SDSS 53 #define KILL_PIN 41 #define BEEPER_PIN 23 @@ -210,7 +210,7 @@ #define BTN_EN2 63 #define BTN_ENC 59 //the click switch //not connected to a pin - #define SDCARDDETECT 49 + #define SDCARDDETECT_PIN 49 #else @@ -235,9 +235,9 @@ #endif #if ENABLED(G3D_PANEL) - #define SDCARDDETECT 49 + #define SDCARDDETECT_PIN 49 #else - #define SDCARDDETECT -1 // Ramps does not use this port + #define SDCARDDETECT_PIN -1 // Ramps does not use this port #endif #endif diff --git a/Marlin/pins_RIGIDBOARD.h b/Marlin/pins_RIGIDBOARD.h index f7789c1daa..9053974347 100644 --- a/Marlin/pins_RIGIDBOARD.h +++ b/Marlin/pins_RIGIDBOARD.h @@ -25,8 +25,8 @@ #undef BEEPER_PIN #define BEEPER_PIN -1 - #undef SDCARDDETECT - #define SDCARDDETECT 22 + #undef SDCARDDETECT_PIN + #define SDCARDDETECT_PIN 22 // Extra button definitions, substitute for EN1 / EN2 #define BTN_UP 37 // BTN_EN1 @@ -43,16 +43,16 @@ #undef BTN_ENC #define BTN_ENC 31 - #undef SDCARDDETECT - #define SDCARDDETECT 22 + #undef SDCARDDETECT_PIN + #define SDCARDDETECT_PIN 22 #elif defined(REPRAP_DISCOUNT_SMART_CONTROLLER) #undef BEEPER_PIN #define BEEPER_PIN -1 - #undef SDCARDDETECT - #define SDCARDDETECT 22 + #undef SDCARDDETECT_PIN + #define SDCARDDETECT_PIN 22 #undef KILL_PIN #define KILL_PIN 32 diff --git a/Marlin/pins_RUMBA.h b/Marlin/pins_RUMBA.h index a8f12aa503..c2ac2c1850 100644 --- a/Marlin/pins_RUMBA.h +++ b/Marlin/pins_RUMBA.h @@ -101,7 +101,7 @@ #define SDPOWER -1 #define SDSS 53 -#define SDCARDDETECT 49 +#define SDCARDDETECT_PIN 49 #define BEEPER_PIN 44 #define LCD_PINS_RS 19 #define LCD_PINS_ENABLE 42 diff --git a/Marlin/pins_SANGUINOLOLU_11.h b/Marlin/pins_SANGUINOLOLU_11.h index 184fa37ec7..93eb68254b 100644 --- a/Marlin/pins_SANGUINOLOLU_11.h +++ b/Marlin/pins_SANGUINOLOLU_11.h @@ -156,7 +156,7 @@ #define LCD_SDSS 28 // Smart Controller SD card reader rather than the Melzi #endif //Panelolu2 - #define SDCARDDETECT -1 + #define SDCARDDETECT_PIN -1 #elif ENABLED(MAKRPANEL) @@ -178,7 +178,7 @@ #define BTN_EN2 10 #define BTN_ENC 16 - #define SDCARDDETECT -1 + #define SDCARDDETECT_PIN -1 #endif // MAKRPANEL diff --git a/Marlin/pins_SAV_MKI.h b/Marlin/pins_SAV_MKI.h index f938e91a2c..e5cfd79f7d 100644 --- a/Marlin/pins_SAV_MKI.h +++ b/Marlin/pins_SAV_MKI.h @@ -83,7 +83,7 @@ #define LED_PIN -1 #define PS_ON_PIN -1 #define ALARM_PIN -1 -#define SDCARDDETECT -1 +#define SDCARDDETECT_PIN -1 #define BEEPER_PIN -1 #define LCD_PINS_RS -1 diff --git a/Marlin/pins_TEENSY2.h b/Marlin/pins_TEENSY2.h index 4f568b7f8e..1328a4a335 100644 --- a/Marlin/pins_TEENSY2.h +++ b/Marlin/pins_TEENSY2.h @@ -86,7 +86,7 @@ #define TEMP_2_PIN -1 #define SDPOWER -1 -#define SDCARDDETECT -1 +#define SDCARDDETECT_PIN -1 #define SDSS 20 // 8 #define LED_PIN 6 #define PS_ON_PIN 27 diff --git a/Marlin/pins_TEENSYLU.h b/Marlin/pins_TEENSYLU.h index 9d0ff9e3f5..0f8c24ed39 100644 --- a/Marlin/pins_TEENSYLU.h +++ b/Marlin/pins_TEENSYLU.h @@ -78,7 +78,7 @@ #define SDSS 40 //use SD card on Panelolu2 (Teensyduino pin mapping) #endif // LCD_I2C_PANELOLU2 - #define SDCARDDETECT -1 + #define SDCARDDETECT_PIN -1 #endif // ULTRA_LCD && NEWPANEL diff --git a/Marlin/pins_ULTIMAIN_2.h b/Marlin/pins_ULTIMAIN_2.h index 46d8ee2a63..95675f4103 100644 --- a/Marlin/pins_ULTIMAIN_2.h +++ b/Marlin/pins_ULTIMAIN_2.h @@ -76,4 +76,4 @@ #define BLEN_B 1 #define BLEN_A 0 -#define SDCARDDETECT 39 +#define SDCARDDETECT_PIN 39 diff --git a/Marlin/pins_ULTIMAKER.h b/Marlin/pins_ULTIMAKER.h index 9f0bb18c83..ef0d2dff69 100644 --- a/Marlin/pins_ULTIMAKER.h +++ b/Marlin/pins_ULTIMAKER.h @@ -73,7 +73,7 @@ #define BTN_EN2 42 #define BTN_ENC 19 - #define SDCARDDETECT 38 + #define SDCARDDETECT_PIN 38 #else //!NEWPANEL - Old style panel with shift register @@ -90,7 +90,7 @@ #define LCD_PINS_D6 20 #define LCD_PINS_D7 19 - #define SDCARDDETECT -1 + #define SDCARDDETECT_PIN -1 #endif // !NEWPANEL diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index fa47947b95..8066e88dec 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -221,7 +221,7 @@ static void lcd_status_screen(); millis_t next_button_update_ms; uint8_t lastEncoderBits; uint32_t encoderPosition; - #if (SDCARDDETECT > 0) + #if PIN_EXISTS(SDCARDDETECT) bool lcd_oldcardstatus; #endif @@ -411,14 +411,14 @@ static void lcd_main_menu() { } else { MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu); - #if SDCARDDETECT < 1 + #if !PIN_EXISTS(SDCARDDETECT) MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21")); // SD-card changed by user #endif } } else { MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu); - #if SDCARDDETECT < 1 + #if !PIN_EXISTS(SDCARDDETECT) MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface #endif } @@ -1156,7 +1156,7 @@ static void lcd_control_volumetric_menu() { } #endif // FWRETRACT -#if SDCARDDETECT == -1 +#if !PIN_EXISTS(SDCARDDETECT) static void lcd_sd_refresh() { card.initsd(); currentMenuViewOffset = 0; @@ -1180,7 +1180,7 @@ void lcd_sdcard_menu() { MENU_ITEM(back, MSG_MAIN, lcd_main_menu); card.getWorkDirName(); if (card.filename[0] == '/') { - #if SDCARDDETECT == -1 + #if !PIN_EXISTS(SDCARDDETECT) MENU_ITEM(function, LCD_STR_REFRESH MSG_REFRESH, lcd_sd_refresh); #endif } @@ -1407,11 +1407,11 @@ void lcd_init() { #endif // SR_LCD_2W_NL #endif//!NEWPANEL - #if ENABLED(SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0) - pinMode(SDCARDDETECT, INPUT); - WRITE(SDCARDDETECT, HIGH); + #if ENABLED(SDSUPPORT) && PIN_EXISTS(SDCARDDETECT) + pinMode(SDCARDDETECT_PIN, INPUT); + WRITE(SDCARDDETECT_PIN, HIGH); lcd_oldcardstatus = IS_SD_INSERTED; - #endif //(SDCARDDETECT > 0) + #endif #if ENABLED(LCD_HAS_SLOW_BUTTONS) slow_buttons = 0; @@ -1466,7 +1466,7 @@ void lcd_update() { lcd_buttons_update(); - #if (SDCARDDETECT > 0) + #if PIN_EXISTS(SDCARDDETECT) if (IS_SD_INSERTED != lcd_oldcardstatus && lcd_detected()) { lcdDrawUpdate = 2; lcd_oldcardstatus = IS_SD_INSERTED;