Selaa lähdekoodia

SD card debugging

Scott Lahteine 3 vuotta sitten
vanhempi
commit
d9ad8caf02
1 muutettua tiedostoa jossa 10 lisäystä ja 0 poistoa
  1. 10
    0
      Marlin/src/sd/cardreader.cpp

+ 10
- 0
Marlin/src/sd/cardreader.cpp Näytä tiedosto

@@ -24,6 +24,8 @@
24 24
 
25 25
 #if ENABLED(SDSUPPORT)
26 26
 
27
+//#define DEBUG_CARDREADER
28
+
27 29
 #include "cardreader.h"
28 30
 
29 31
 #include "../MarlinCore.h"
@@ -51,6 +53,9 @@
51 53
   #include "../feature/pause.h"
52 54
 #endif
53 55
 
56
+#define DEBUG_OUT ENABLED(DEBUG_CARDREADER)
57
+#include "../core/debug_out.h"
58
+
54 59
 // public:
55 60
 
56 61
 card_flags_t CardReader::flag;
@@ -405,6 +410,8 @@ void CardReader::manage_media() {
405 410
   uint8_t stat = uint8_t(IS_SD_INSERTED());
406 411
   if (stat == prev_stat) return;
407 412
 
413
+  DEBUG_ECHOLNPAIR("SD: Status changed from ", prev_stat, " to ", stat);
414
+
408 415
   flag.workDirIsRoot = true;          // Return to root on mount/release
409 416
 
410 417
   if (ui.detected()) {
@@ -431,12 +438,15 @@ void CardReader::manage_media() {
431 438
     if (stat) {
432 439
       TERN_(SDCARD_EEPROM_EMULATION, settings.first_load());
433 440
       if (old_stat == 2)              // First mount?
441
+        DEBUG_ECHOLNPGM("First mount.");
434 442
         TERN(POWER_LOSS_RECOVERY,
435 443
           recovery.check(),           // Check for PLR file. (If not there it will beginautostart)
436 444
           beginautostart()            // Look for auto0.g on the next loop
437 445
         );
438 446
     }
439 447
   }
448
+  else
449
+    DEBUG_ECHOLNPGM("SD: No UI Detected.");
440 450
 }
441 451
 
442 452
 void CardReader::release() {

Loading…
Peruuta
Tallenna