Kaynağa Gözat

Rename SDCARDDETECT to SDCARDDETECT_PIN

- Rename the pin so it can be tested with `PIN_EXISTS`
- Fix some incorrect tests for `SDCARDDETECT`
Scott Lahteine 8 yıl önce
ebeveyn
işleme
8d3b74cc6e

+ 3
- 3
Marlin/cardreader.h Dosyayı Görüntüle

@@ -81,11 +81,11 @@ extern CardReader card;
81 81
 
82 82
 #define IS_SD_PRINTING (card.sdprinting)
83 83
 
84
-#if (SDCARDDETECT > -1)
84
+#if PIN_EXISTS(SDCARDDETECT)
85 85
   #if ENABLED(SDCARDDETECTINVERTED)
86
-    #define IS_SD_INSERTED (READ(SDCARDDETECT) != 0)
86
+    #define IS_SD_INSERTED (READ(SDCARDDETECT_PIN) != 0)
87 87
   #else
88
-    #define IS_SD_INSERTED (READ(SDCARDDETECT) == 0)
88
+    #define IS_SD_INSERTED (READ(SDCARDDETECT_PIN) == 0)
89 89
   #endif
90 90
 #else
91 91
   //No card detect line? Assume the card is inserted.

+ 1
- 1
Marlin/pins_AZTEEG_X3_PRO.h Dosyayı Görüntüle

@@ -109,7 +109,7 @@
109 109
   #define BTN_ENC          39  //the click switch
110 110
  
111 111
   #define SDSS             53
112
-  #define SDCARDDETECT     49
112
+  #define SDCARDDETECT_PIN 49
113 113
   
114 114
   #define KILL_PIN         31
115 115
  #endif

+ 1
- 1
Marlin/pins_BRAINWAVE_PRO.h Dosyayı Görüntüle

@@ -54,7 +54,7 @@
54 54
 #define PS_ON_PIN          -1
55 55
 #define KILL_PIN           -1
56 56
 #define ALARM_PIN          -1
57
-#define SDCARDDETECT       12
57
+#define SDCARDDETECT_PIN   12
58 58
 
59 59
 #if DISABLED(SDSUPPORT)
60 60
 // these pins are defined in the SD library if building with SD support

+ 1
- 1
Marlin/pins_CHEAPTRONIC.h Dosyayı Görüntüle

@@ -86,4 +86,4 @@
86 86
 #define BLEN_A 0
87 87
 
88 88
 // Cheaptronic v1.0 does not use this port
89
-#define SDCARDDETECT -1
89
+#define SDCARDDETECT_PIN -1

+ 1
- 1
Marlin/pins_ELEFU_3.h Dosyayı Görüntüle

@@ -64,7 +64,7 @@
64 64
 #if ENABLED(RA_CONTROL_PANEL)
65 65
 
66 66
   #define SDSS             53
67
-  #define SDCARDDETECT     28
67
+  #define SDCARDDETECT_PIN 28
68 68
 
69 69
   #define BTN_EN1          14
70 70
   #define BTN_EN2          39

+ 1
- 1
Marlin/pins_FELIX2.h Dosyayı Görüntüle

@@ -19,6 +19,6 @@
19 19
   #define BLEN_C 2
20 20
   #define BLEN_B 1
21 21
   #define BLEN_A 0
22
-  #define SDCARDDETECT 6
22
+  #define SDCARDDETECT_PIN 6
23 23
 
24 24
 #endif // NEWPANEL && ULTRA_LCD

+ 1
- 1
Marlin/pins_GEN7_CUSTOM.h Dosyayı Görüntüle

@@ -57,7 +57,7 @@
57 57
 //#define RX_ENABLE_PIN       13
58 58
 
59 59
 #define BEEPER_PIN -1
60
-#define SDCARDDETECT -1
60
+#define SDCARDDETECT_PIN -1
61 61
 #define SUICIDE_PIN -1    //has to be defined; otherwise Power_off doesn't work
62 62
 
63 63
 #define KILL_PIN -1

+ 1
- 1
Marlin/pins_LEAPFROG.h Dosyayı Görüntüle

@@ -42,7 +42,7 @@
42 42
 
43 43
 #define SDPOWER            -1
44 44
 #define SDSS               11
45
-#define SDCARDDETECT       -1 // 10 optional also used as mode pin
45
+#define SDCARDDETECT_PIN   -1 // 10 optional also used as mode pin
46 46
 #define LED_PIN            13
47 47
 #define FAN_PIN            7
48 48
 #define PS_ON_PIN          -1

+ 1
- 1
Marlin/pins_MEGACONTROLLER.h Dosyayı Görüntüle

@@ -107,6 +107,6 @@
107 107
     #define BTN_EN2 11
108 108
     #define BTN_ENC 10  //the click switch
109 109
     //not connected to a pin
110
-    #define SDCARDDETECT 49
110
+    #define SDCARDDETECT_PIN 49
111 111
 #endif //Minipanel
112 112
 

+ 1
- 1
Marlin/pins_MEGATRONICS.h Dosyayı Görüntüle

@@ -78,6 +78,6 @@
78 78
   #define BLEN_B           1
79 79
   #define BLEN_A           0
80 80
 
81
-  #define SDCARDDETECT    -1   // RAMPS doesn't use this
81
+  #define SDCARDDETECT_PIN -1   // RAMPS doesn't use this
82 82
 
83 83
 #endif // ULTRA_LCD && NEWPANEL

+ 1
- 1
Marlin/pins_MEGATRONICS_2.h Dosyayı Görüntüle

@@ -94,4 +94,4 @@
94 94
 #define BLEN_B 1
95 95
 #define BLEN_A 0
96 96
 
97
-#define SDCARDDETECT -1  // Megatronics does not use this port
97
+#define SDCARDDETECT_PIN -1  // Megatronics does not use this port

+ 1
- 1
Marlin/pins_MEGATRONICS_3.h Dosyayı Görüntüle

@@ -99,4 +99,4 @@
99 99
 #define BLEN_B 1
100 100
 #define BLEN_A 0
101 101
 
102
-#define SDCARDDETECT -1	// Megatronics does not use this port
102
+#define SDCARDDETECT_PIN -1	// Megatronics does not use this port

+ 1
- 1
Marlin/pins_MINIRAMBO.h Dosyayı Görüntüle

@@ -107,7 +107,7 @@
107 107
     #define BTN_EN2         72
108 108
     #define BTN_ENC          9  // the click
109 109
 
110
-    #define SDCARDDETECT    15
110
+    #define SDCARDDETECT_PIN 15
111 111
 
112 112
   #endif //NEWPANEL
113 113
 #endif //ULTRA_LCD

+ 1
- 1
Marlin/pins_MINITRONICS.h Dosyayı Görüntüle

@@ -78,4 +78,4 @@
78 78
 #define BLEN_B 1
79 79
 #define BLEN_A 0
80 80
 
81
-#define SDCARDDETECT -1  // Megatronics does not use this port
81
+#define SDCARDDETECT_PIN -1  // Minitronics does not use this port

+ 1
- 1
Marlin/pins_OMCA.h Dosyayı Görüntüle

@@ -70,7 +70,7 @@
70 70
 
71 71
 #define SDPOWER            -1
72 72
 #define SDSS               11
73
-#define SDCARDDETECT       -1 // 10 optional also used as mode pin
73
+#define SDCARDDETECT_PIN   -1 // 10 optional also used as mode pin
74 74
 #define LED_PIN            -1
75 75
 #define FAN_PIN            14 // PWM on MIDDLE connector
76 76
 #define PS_ON_PIN          -1

+ 1
- 1
Marlin/pins_OMCA_A.h Dosyayı Görüntüle

@@ -61,7 +61,7 @@
61 61
 
62 62
 #define SDPOWER            -1
63 63
 #define SDSS               11
64
-#define SDCARDDETECT       -1 // 10 optional also used as mode pin
64
+#define SDCARDDETECT_PIN   -1 // 10 optional also used as mode pin
65 65
 #define LED_PIN            -1
66 66
 #define FAN_PIN            3
67 67
 #define PS_ON_PIN          -1

+ 2
- 2
Marlin/pins_PRINTRBOARD.h Dosyayı Görüntüle

@@ -88,7 +88,7 @@
88 88
     #define SDSS   40 //use SD card on Panelolu2 (Teensyduino pin mapping)
89 89
   #endif // LCD_I2C_PANELOLU2
90 90
   //not connected to a pin
91
-  #define SDCARDDETECT -1    
91
+  #define SDCARDDETECT_PIN -1    
92 92
 #endif // ULTRA_LCD && NEWPANEL
93 93
 
94 94
 #if ENABLED(VIKI2) || ENABLED(miniVIKI)
@@ -104,7 +104,7 @@
104 104
  #define BTN_ENC 47  //the click switch
105 105
 
106 106
  #define SDSS 45
107
- #define SDCARDDETECT -1 // FastIO (Manual says 72 I'm not certain cause I can't test) 
107
+ #define SDCARDDETECT_PIN -1 // FastIO (Manual says 72 I'm not certain cause I can't test) 
108 108
 
109 109
  #if ENABLED(TEMP_STAT_LEDS)
110 110
   #define STAT_LED_RED      12 //Non-FastIO

+ 2
- 2
Marlin/pins_RAMBO.h Dosyayı Görüntüle

@@ -133,7 +133,7 @@
133 133
     #define BLEN_B 1
134 134
     #define BLEN_A 0
135 135
 
136
-    #define SDCARDDETECT 81    // Ramps does not use this port
136
+    #define SDCARDDETECT_PIN 81 // Ramps doesn't use this port
137 137
 
138 138
   #else //!NEWPANEL - old style panel with shift register
139 139
 
@@ -180,7 +180,7 @@
180 180
  #define BTN_EN2 84
181 181
  #define BTN_ENC 83  //the click switch
182 182
 
183
- #define SDCARDDETECT -1 // Pin 72 if using easy adapter board   
183
+ #define SDCARDDETECT_PIN -1 // Pin 72 if using easy adapter board   
184 184
 
185 185
   #if ENABLED(TEMP_STAT_LEDS)
186 186
    #define STAT_LED_RED      22

+ 7
- 7
Marlin/pins_RAMPS_13.h Dosyayı Görüntüle

@@ -165,25 +165,25 @@
165 165
       #define BTN_EN2 33
166 166
       #define BTN_ENC 35
167 167
 
168
-      #define SDCARDDETECT 49
168
+      #define SDCARDDETECT_PIN 49
169 169
     #elif ENABLED(LCD_I2C_PANELOLU2)
170 170
       #define BTN_EN1 47  // reverse if the encoder turns the wrong way.
171 171
       #define BTN_EN2 43
172 172
       #define BTN_ENC 32
173 173
       #define LCD_SDSS 53
174
-      #define SDCARDDETECT -1
174
+      #define SDCARDDETECT_PIN -1
175 175
       #define KILL_PIN 41
176 176
     #elif ENABLED(LCD_I2C_VIKI)
177 177
       #define BTN_EN1 22  // reverse if the encoder turns the wrong way.
178 178
       #define BTN_EN2 7
179 179
       #define BTN_ENC -1
180 180
       #define LCD_SDSS 53
181
-      #define SDCARDDETECT 49
181
+      #define SDCARDDETECT_PIN 49
182 182
     #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
183 183
       #define BTN_EN1 35  // reverse if the encoder turns the wrong way.
184 184
       #define BTN_EN2 37
185 185
       #define BTN_ENC 31
186
-      #define SDCARDDETECT 49
186
+      #define SDCARDDETECT_PIN 49
187 187
       #define LCD_SDSS 53
188 188
       #define KILL_PIN 41
189 189
       #define BEEPER_PIN 23
@@ -210,7 +210,7 @@
210 210
        #define BTN_EN2 63
211 211
        #define BTN_ENC 59  //the click switch
212 212
        //not connected to a pin
213
-       #define SDCARDDETECT 49
213
+       #define SDCARDDETECT_PIN 49
214 214
 
215 215
     #else
216 216
 
@@ -235,9 +235,9 @@
235 235
       #endif
236 236
 
237 237
       #if ENABLED(G3D_PANEL)
238
-        #define SDCARDDETECT 49
238
+        #define SDCARDDETECT_PIN 49
239 239
       #else
240
-        #define SDCARDDETECT -1  // Ramps does not use this port
240
+        #define SDCARDDETECT_PIN -1  // Ramps does not use this port
241 241
       #endif
242 242
 
243 243
     #endif

+ 6
- 6
Marlin/pins_RIGIDBOARD.h Dosyayı Görüntüle

@@ -25,8 +25,8 @@
25 25
   #undef BEEPER_PIN
26 26
   #define BEEPER_PIN -1
27 27
 
28
-  #undef SDCARDDETECT
29
-  #define SDCARDDETECT 22
28
+  #undef SDCARDDETECT_PIN
29
+  #define SDCARDDETECT_PIN 22
30 30
 
31 31
   // Extra button definitions, substitute for EN1 / EN2
32 32
   #define BTN_UP  37 // BTN_EN1
@@ -43,16 +43,16 @@
43 43
   #undef  BTN_ENC
44 44
   #define BTN_ENC 31
45 45
 
46
-  #undef  SDCARDDETECT
47
-  #define SDCARDDETECT 22
46
+  #undef  SDCARDDETECT_PIN
47
+  #define SDCARDDETECT_PIN 22
48 48
 
49 49
 #elif defined(REPRAP_DISCOUNT_SMART_CONTROLLER)
50 50
 
51 51
   #undef BEEPER_PIN
52 52
   #define BEEPER_PIN -1
53 53
 
54
-  #undef  SDCARDDETECT
55
-  #define SDCARDDETECT 22
54
+  #undef  SDCARDDETECT_PIN
55
+  #define SDCARDDETECT_PIN 22
56 56
 
57 57
   #undef  KILL_PIN
58 58
   #define KILL_PIN 32

+ 1
- 1
Marlin/pins_RUMBA.h Dosyayı Görüntüle

@@ -101,7 +101,7 @@
101 101
 
102 102
 #define SDPOWER            -1
103 103
 #define SDSS               53
104
-#define SDCARDDETECT       49
104
+#define SDCARDDETECT_PIN   49
105 105
 #define BEEPER_PIN         44
106 106
 #define LCD_PINS_RS        19
107 107
 #define LCD_PINS_ENABLE    42

+ 2
- 2
Marlin/pins_SANGUINOLOLU_11.h Dosyayı Görüntüle

@@ -156,7 +156,7 @@
156 156
     #define LCD_SDSS            28 // Smart Controller SD card reader rather than the Melzi
157 157
   #endif //Panelolu2
158 158
 
159
-  #define SDCARDDETECT          -1
159
+  #define SDCARDDETECT_PIN      -1
160 160
 
161 161
 #elif ENABLED(MAKRPANEL)
162 162
 
@@ -178,7 +178,7 @@
178 178
   #define BTN_EN2               10
179 179
   #define BTN_ENC               16
180 180
 
181
-  #define SDCARDDETECT          -1
181
+  #define SDCARDDETECT_PIN      -1
182 182
 
183 183
 #endif // MAKRPANEL
184 184
 

+ 1
- 1
Marlin/pins_SAV_MKI.h Dosyayı Görüntüle

@@ -83,7 +83,7 @@
83 83
 #define LED_PIN            -1
84 84
 #define PS_ON_PIN          -1
85 85
 #define ALARM_PIN          -1
86
-#define SDCARDDETECT       -1
86
+#define SDCARDDETECT_PIN   -1
87 87
 
88 88
 #define BEEPER_PIN         -1
89 89
 #define LCD_PINS_RS        -1

+ 1
- 1
Marlin/pins_TEENSY2.h Dosyayı Görüntüle

@@ -86,7 +86,7 @@
86 86
 #define TEMP_2_PIN         -1
87 87
 
88 88
 #define SDPOWER            -1
89
-#define SDCARDDETECT       -1   
89
+#define SDCARDDETECT_PIN   -1   
90 90
 #define SDSS               20 // 8
91 91
 #define LED_PIN             6
92 92
 #define PS_ON_PIN          27

+ 1
- 1
Marlin/pins_TEENSYLU.h Dosyayı Görüntüle

@@ -78,7 +78,7 @@
78 78
     #define SDSS           40  //use SD card on Panelolu2 (Teensyduino pin mapping)
79 79
   #endif // LCD_I2C_PANELOLU2
80 80
 
81
-  #define SDCARDDETECT     -1
81
+  #define SDCARDDETECT_PIN -1    
82 82
 
83 83
 #endif // ULTRA_LCD && NEWPANEL
84 84
 

+ 1
- 1
Marlin/pins_ULTIMAIN_2.h Dosyayı Görüntüle

@@ -76,4 +76,4 @@
76 76
 #define BLEN_B 1
77 77
 #define BLEN_A 0
78 78
 
79
-#define SDCARDDETECT 39
79
+#define SDCARDDETECT_PIN 39

+ 2
- 2
Marlin/pins_ULTIMAKER.h Dosyayı Görüntüle

@@ -73,7 +73,7 @@
73 73
     #define BTN_EN2 42
74 74
     #define BTN_ENC 19
75 75
 
76
-    #define SDCARDDETECT 38
76
+    #define SDCARDDETECT_PIN 38
77 77
 
78 78
   #else //!NEWPANEL - Old style panel with shift register
79 79
 
@@ -90,7 +90,7 @@
90 90
     #define LCD_PINS_D6 20
91 91
     #define LCD_PINS_D7 19
92 92
 
93
-    #define SDCARDDETECT -1
93
+    #define SDCARDDETECT_PIN -1
94 94
 
95 95
   #endif // !NEWPANEL
96 96
 

+ 10
- 10
Marlin/ultralcd.cpp Dosyayı Görüntüle

@@ -221,7 +221,7 @@ static void lcd_status_screen();
221 221
   millis_t next_button_update_ms;
222 222
   uint8_t lastEncoderBits;
223 223
   uint32_t encoderPosition;
224
-  #if (SDCARDDETECT > 0)
224
+  #if PIN_EXISTS(SDCARDDETECT)
225 225
     bool lcd_oldcardstatus;
226 226
   #endif
227 227
 
@@ -411,14 +411,14 @@ static void lcd_main_menu() {
411 411
       }
412 412
       else {
413 413
         MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu);
414
-        #if SDCARDDETECT < 1
414
+        #if !PIN_EXISTS(SDCARDDETECT)
415 415
           MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21"));  // SD-card changed by user
416 416
         #endif
417 417
       }
418 418
     }
419 419
     else {
420 420
       MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu);
421
-      #if SDCARDDETECT < 1
421
+      #if !PIN_EXISTS(SDCARDDETECT)
422 422
         MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface
423 423
       #endif
424 424
     }
@@ -1156,7 +1156,7 @@ static void lcd_control_volumetric_menu() {
1156 1156
   }
1157 1157
 #endif // FWRETRACT
1158 1158
 
1159
-#if SDCARDDETECT == -1
1159
+#if !PIN_EXISTS(SDCARDDETECT)
1160 1160
   static void lcd_sd_refresh() {
1161 1161
     card.initsd();
1162 1162
     currentMenuViewOffset = 0;
@@ -1180,7 +1180,7 @@ void lcd_sdcard_menu() {
1180 1180
   MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
1181 1181
   card.getWorkDirName();
1182 1182
   if (card.filename[0] == '/') {
1183
-    #if SDCARDDETECT == -1
1183
+    #if !PIN_EXISTS(SDCARDDETECT)
1184 1184
       MENU_ITEM(function, LCD_STR_REFRESH MSG_REFRESH, lcd_sd_refresh);
1185 1185
     #endif
1186 1186
   }
@@ -1407,11 +1407,11 @@ void lcd_init() {
1407 1407
   #endif // SR_LCD_2W_NL
1408 1408
 #endif//!NEWPANEL
1409 1409
 
1410
-  #if ENABLED(SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0)
1411
-    pinMode(SDCARDDETECT, INPUT);
1412
-    WRITE(SDCARDDETECT, HIGH);
1410
+  #if ENABLED(SDSUPPORT) && PIN_EXISTS(SDCARDDETECT)
1411
+    pinMode(SDCARDDETECT_PIN, INPUT);
1412
+    WRITE(SDCARDDETECT_PIN, HIGH);
1413 1413
     lcd_oldcardstatus = IS_SD_INSERTED;
1414
-  #endif //(SDCARDDETECT > 0)
1414
+  #endif
1415 1415
 
1416 1416
   #if ENABLED(LCD_HAS_SLOW_BUTTONS)
1417 1417
     slow_buttons = 0;
@@ -1466,7 +1466,7 @@ void lcd_update() {
1466 1466
 
1467 1467
   lcd_buttons_update();
1468 1468
 
1469
-  #if (SDCARDDETECT > 0)
1469
+  #if PIN_EXISTS(SDCARDDETECT)
1470 1470
     if (IS_SD_INSERTED != lcd_oldcardstatus && lcd_detected()) {
1471 1471
       lcdDrawUpdate = 2;
1472 1472
       lcd_oldcardstatus = IS_SD_INSERTED;

Loading…
İptal
Kaydet