Browse Source

Default to SD Card Disabled (PR#139)

Richard Wackerbarth 9 years ago
parent
commit
fe0cbd40fe
2 changed files with 88 additions and 73 deletions
  1. 0
    4
      Marlin/Conditionals.h
  2. 88
    69
      Marlin/ultralcd.cpp

+ 0
- 4
Marlin/Conditionals.h View File

@@ -16,7 +16,6 @@
16 16
 
17 17
   #if ENABLED(MAKRPANEL)
18 18
     #define DOGLCD
19
-    #define SDSUPPORT
20 19
     #define DEFAULT_LCD_CONTRAST 17
21 20
     #define ULTIPANEL
22 21
     #define NEWPANEL
@@ -48,7 +47,6 @@
48 47
 
49 48
 
50 49
   #if ENABLED(PANEL_ONE)
51
-    #define SDSUPPORT
52 50
     #define ULTIMAKERCONTROLLER
53 51
   #endif
54 52
 
@@ -77,7 +75,6 @@
77 75
 
78 76
   #if ENABLED(MINIPANEL)
79 77
    #define DOGLCD
80
-   #define SDSUPPORT
81 78
    #define ULTIPANEL
82 79
    #define NEWPANEL
83 80
    #define DEFAULT_LCD_CONTRAST 17
@@ -145,7 +142,6 @@
145 142
 
146 143
   #if ENABLED(ULTIPANEL)
147 144
     #define NEWPANEL  //enable this if you have a click-encoder panel
148
-    #define SDSUPPORT
149 145
     #define ULTRA_LCD
150 146
     #if ENABLED(DOGLCD) // Change number of lines to match the DOG graphic display
151 147
       #define LCD_WIDTH 22

+ 88
- 69
Marlin/ultralcd.cpp View File

@@ -283,22 +283,25 @@ static void lcd_status_screen() {
283 283
     #if PROGRESS_MSG_EXPIRE > 0
284 284
       // Handle message expire
285 285
       if (expire_status_ms > 0) {
286
-        if (card.isFileOpen()) {
287
-          // Expire the message when printing is active
288
-          if (IS_SD_PRINTING) {
286
+        #if ENABLED(SDSUPPORT)
287
+          if (card.isFileOpen()) {
289 288
             // Expire the message when printing is active
290
-            if (ms >= expire_status_ms) {
291
-              lcd_status_message[0] = '\0';
292
-              expire_status_ms = 0;
289
+            if (IS_SD_PRINTING) {
290
+              if (ms >= expire_status_ms) {
291
+                lcd_status_message[0] = '\0';
292
+                expire_status_ms = 0;
293
+              }
294
+            }
295
+            else {
296
+              expire_status_ms += LCD_UPDATE_INTERVAL;
293 297
             }
294 298
           }
295 299
           else {
296
-            expire_status_ms += LCD_UPDATE_INTERVAL;
300
+            expire_status_ms = 0;
297 301
           }
298
-        }
299
-        else {
302
+        #else
300 303
           expire_status_ms = 0;
301
-        }
304
+        #endif //SDSUPPORT
302 305
       }
303 306
     #endif
304 307
   #endif //LCD_PROGRESS_BAR
@@ -367,18 +370,22 @@ static void lcd_status_screen() {
367 370
 
368 371
 static void lcd_return_to_status() { lcd_goto_menu(lcd_status_screen); }
369 372
 
370
-static void lcd_sdcard_pause() { card.pauseSDPrint(); }
373
+#if ENABLED(SDSUPPORT)
371 374
 
372
-static void lcd_sdcard_resume() { card.startFileprint(); }
375
+  static void lcd_sdcard_pause() { card.pauseSDPrint(); }
373 376
 
374
-static void lcd_sdcard_stop() {
375
-  quickStop();
376
-  card.sdprinting = false;
377
-  card.closefile();
378
-  autotempShutdown();
379
-  cancel_heatup = true;
380
-  lcd_setstatus(MSG_PRINT_ABORTED, true);
381
-}
377
+  static void lcd_sdcard_resume() { card.startFileprint(); }
378
+
379
+  static void lcd_sdcard_stop() {
380
+    quickStop();
381
+    card.sdprinting = false;
382
+    card.closefile();
383
+    autotempShutdown();
384
+    cancel_heatup = true;
385
+    lcd_setstatus(MSG_PRINT_ABORTED, true);
386
+  }
387
+
388
+#endif //SDSUPPORT
382 389
 
383 390
 /**
384 391
  *
@@ -1186,57 +1193,61 @@ static void lcd_control_volumetric_menu() {
1186 1193
   }
1187 1194
 #endif // FWRETRACT
1188 1195
 
1189
-#if !PIN_EXISTS(SD_DETECT)
1190
-  static void lcd_sd_refresh() {
1191
-    card.initsd();
1192
-    currentMenuViewOffset = 0;
1193
-  }
1194
-#endif
1196
+#if ENABLED(SDSUPPORT)
1195 1197
 
1196
-static void lcd_sd_updir() {
1197
-  card.updir();
1198
-  currentMenuViewOffset = 0;
1199
-}
1198
+  #if !PIN_EXISTS(SD_DETECT)
1199
+    static void lcd_sd_refresh() {
1200
+      card.initsd();
1201
+      currentMenuViewOffset = 0;
1202
+    }
1203
+  #endif
1200 1204
 
1201
-/**
1202
- *
1203
- * "Print from SD" submenu
1204
- *
1205
- */
1206
-void lcd_sdcard_menu() {
1207
-  if (lcdDrawUpdate == 0 && LCD_CLICKED == 0) return;	// nothing to do (so don't thrash the SD card)
1208
-  uint16_t fileCnt = card.getnrfilenames();
1209
-  START_MENU();
1210
-  MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
1211
-  card.getWorkDirName();
1212
-  if (card.filename[0] == '/') {
1213
-    #if !PIN_EXISTS(SD_DETECT)
1214
-      MENU_ITEM(function, LCD_STR_REFRESH MSG_REFRESH, lcd_sd_refresh);
1215
-    #endif
1216
-  }
1217
-  else {
1218
-    MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir);
1205
+  static void lcd_sd_updir() {
1206
+    card.updir();
1207
+    currentMenuViewOffset = 0;
1219 1208
   }
1220 1209
 
1221
-  for (uint16_t i = 0; i < fileCnt; i++) {
1222
-    if (_menuItemNr == _lineNr) {
1223
-      card.getfilename(
1224
-        #if ENABLED(SDCARD_RATHERRECENTFIRST)
1225
-          fileCnt-1 -
1226
-        #endif
1227
-        i
1228
-      );
1229
-      if (card.filenameIsDir)
1230
-        MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename);
1231
-      else
1232
-        MENU_ITEM(sdfile, MSG_CARD_MENU, card.filename, card.longFilename);
1210
+  /**
1211
+   *
1212
+   * "Print from SD" submenu
1213
+   *
1214
+   */
1215
+  void lcd_sdcard_menu() {
1216
+    if (lcdDrawUpdate == 0 && LCD_CLICKED == 0) return;	// nothing to do (so don't thrash the SD card)
1217
+    uint16_t fileCnt = card.getnrfilenames();
1218
+    START_MENU();
1219
+    MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
1220
+    card.getWorkDirName();
1221
+    if (card.filename[0] == '/') {
1222
+      #if !PIN_EXISTS(SD_DETECT)
1223
+        MENU_ITEM(function, LCD_STR_REFRESH MSG_REFRESH, lcd_sd_refresh);
1224
+      #endif
1233 1225
     }
1234 1226
     else {
1235
-      MENU_ITEM_DUMMY();
1227
+      MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir);
1228
+    }
1229
+
1230
+    for (uint16_t i = 0; i < fileCnt; i++) {
1231
+      if (_menuItemNr == _lineNr) {
1232
+        card.getfilename(
1233
+          #if ENABLED(SDCARD_RATHERRECENTFIRST)
1234
+            fileCnt-1 -
1235
+          #endif
1236
+          i
1237
+        );
1238
+        if (card.filenameIsDir)
1239
+          MENU_ITEM(sddirectory, MSG_CARD_MENU, card.filename, card.longFilename);
1240
+        else
1241
+          MENU_ITEM(sdfile, MSG_CARD_MENU, card.filename, card.longFilename);
1242
+      }
1243
+      else {
1244
+        MENU_ITEM_DUMMY();
1245
+      }
1236 1246
     }
1247
+    END_MENU();
1237 1248
   }
1238
-  END_MENU();
1239
-}
1249
+
1250
+ #endif //SDSUPPORT
1240 1251
 
1241 1252
 /**
1242 1253
  *
@@ -1389,10 +1400,16 @@ static void menu_action_sdfile(const char* filename, char* longFilename) {
1389 1400
   enqueuecommands_P(PSTR("M24"));
1390 1401
   lcd_return_to_status();
1391 1402
 }
1392
-static void menu_action_sddirectory(const char* filename, char* longFilename) {
1393
-  card.chdir(filename);
1394
-  encoderPosition = 0;
1395
-}
1403
+
1404
+#if ENABLED(SDSUPPORT)
1405
+
1406
+  static void menu_action_sddirectory(const char* filename, char* longFilename) {
1407
+    card.chdir(filename);
1408
+    encoderPosition = 0;
1409
+  }
1410
+
1411
+#endif
1412
+
1396 1413
 static void menu_action_setting_edit_bool(const char* pstr, bool* ptr) { *ptr = !(*ptr); }
1397 1414
 static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callback) {
1398 1415
   menu_action_setting_edit_bool(pstr, ptr);
@@ -1496,7 +1513,8 @@ void lcd_update() {
1496 1513
 
1497 1514
   lcd_buttons_update();
1498 1515
 
1499
-  #if PIN_EXISTS(SD_DETECT)
1516
+  #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
1517
+
1500 1518
     if (IS_SD_INSERTED != lcd_oldcardstatus && lcd_detected()) {
1501 1519
       lcdDrawUpdate = 2;
1502 1520
       lcd_oldcardstatus = IS_SD_INSERTED;
@@ -1515,7 +1533,8 @@ void lcd_update() {
1515 1533
         LCD_MESSAGEPGM(MSG_SD_REMOVED);
1516 1534
       }
1517 1535
     }
1518
-  #endif//CARDINSERTED
1536
+
1537
+  #endif //SDSUPPORT && SD_DETECT_PIN
1519 1538
   
1520 1539
   millis_t ms = millis();
1521 1540
   if (ms > next_lcd_update_ms) {

Loading…
Cancel
Save