Browse Source

Try to init SD with no detect pin

Scott Lahteine 6 years ago
parent
commit
eb1c9113c2
2 changed files with 19 additions and 13 deletions
  1. 1
    1
      Marlin/src/Marlin.cpp
  2. 18
    12
      Marlin/src/lcd/ultralcd.cpp

+ 1
- 1
Marlin/src/Marlin.cpp View File

937
     ui.show_bootscreen();
937
     ui.show_bootscreen();
938
   #endif
938
   #endif
939
 
939
 
940
-  #if ENABLED(SDIO_SUPPORT) && SD_DETECT_PIN == -1
940
+  #if ENABLED(SDIO_SUPPORT) && !PIN_EXISTS(SD_DETECT)
941
     // Auto-mount the SD for EEPROM.dat emulation
941
     // Auto-mount the SD for EEPROM.dat emulation
942
     if (!card.isDetected()) card.initsd();
942
     if (!card.isDetected()) card.initsd();
943
   #endif
943
   #endif

+ 18
- 12
Marlin/src/lcd/ultralcd.cpp View File

104
   #endif
104
   #endif
105
 #endif
105
 #endif
106
 
106
 
107
-#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
107
+#if ENABLED(SDSUPPORT)
108
   uint8_t lcd_sd_status;
108
   uint8_t lcd_sd_status;
109
 #endif
109
 #endif
110
 
110
 
315
 
315
 
316
   #endif // HAS_SHIFT_ENCODER
316
   #endif // HAS_SHIFT_ENCODER
317
 
317
 
318
-  #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
319
-    SET_INPUT_PULLUP(SD_DETECT_PIN);
318
+  #if ENABLED(SDSUPPORT)
319
+    #if PIN_EXISTS(SD_DETECT)
320
+      SET_INPUT_PULLUP(SD_DETECT_PIN);
321
+    #endif
320
     lcd_sd_status = 2; // UNKNOWN
322
     lcd_sd_status = 2; // UNKNOWN
321
   #endif
323
   #endif
322
 
324
 
766
 
768
 
767
   #endif // HAS_LCD_MENU
769
   #endif // HAS_LCD_MENU
768
 
770
 
769
-  #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
771
+  #if ENABLED(SDSUPPORT)
770
 
772
 
771
     const uint8_t sd_status = (uint8_t)IS_SD_INSERTED();
773
     const uint8_t sd_status = (uint8_t)IS_SD_INSERTED();
772
     if (sd_status != lcd_sd_status && detected()) {
774
     if (sd_status != lcd_sd_status && detected()) {
782
         else
784
         else
783
           set_status_P(PSTR(MSG_SD_INSERTED));
785
           set_status_P(PSTR(MSG_SD_INSERTED));
784
       }
786
       }
785
-      else {
786
-        card.release();
787
-        if (old_sd_status != 2) {
788
-          set_status_P(PSTR(MSG_SD_REMOVED));
789
-          if (!on_status_screen()) return_to_status();
787
+      #if PIN_EXISTS(SD_DETECT)
788
+        else {
789
+          card.release();
790
+          if (old_sd_status != 2) {
791
+            set_status_P(PSTR(MSG_SD_REMOVED));
792
+            if (!on_status_screen()) return_to_status();
793
+          }
790
         }
794
         }
791
-      }
795
+
796
+        init_lcd(); // May revive the LCD if static electricity killed it
797
+
798
+      #endif
792
 
799
 
793
       refresh();
800
       refresh();
794
-      init_lcd(); // May revive the LCD if static electricity killed it
795
 
801
 
796
       ms = millis();
802
       ms = millis();
797
       next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL;  // delay LCD update until after SD activity completes
803
       next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL;  // delay LCD update until after SD activity completes
801
       #endif
807
       #endif
802
     }
808
     }
803
 
809
 
804
-  #endif // SDSUPPORT && SD_DETECT_PIN
810
+  #endif // SDSUPPORT
805
 
811
 
806
   if (ELAPSED(ms, next_lcd_update_ms)
812
   if (ELAPSED(ms, next_lcd_update_ms)
807
     #if HAS_GRAPHICAL_LCD
813
     #if HAS_GRAPHICAL_LCD

Loading…
Cancel
Save