From c1d9e8d5714e4036575629648273d90e1b6bd88a Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 4 Sep 2020 13:50:08 -0500 Subject: [PATCH] SD card debugging --- Marlin/src/sd/cardreader.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 3eacf8b69f..f8f1bf18e6 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -24,6 +24,8 @@ #if ENABLED(SDSUPPORT) +//#define DEBUG_CARDREADER + #include "cardreader.h" #include "../MarlinCore.h" @@ -51,6 +53,9 @@ #include "../feature/pause.h" #endif +#define DEBUG_OUT ENABLED(DEBUG_CARDREADER) +#include "../core/debug_out.h" + // public: card_flags_t CardReader::flag; @@ -405,6 +410,8 @@ void CardReader::manage_media() { uint8_t stat = uint8_t(IS_SD_INSERTED()); if (stat == prev_stat) return; + DEBUG_ECHOLNPAIR("SD: Status changed from ", prev_stat, " to ", stat); + flag.workDirIsRoot = true; // Return to root on mount/release if (ui.detected()) { @@ -431,12 +438,15 @@ void CardReader::manage_media() { if (stat) { TERN_(SDCARD_EEPROM_EMULATION, settings.first_load()); if (old_stat == 2) // First mount? + DEBUG_ECHOLNPGM("First mount."); TERN(POWER_LOSS_RECOVERY, recovery.check(), // Check for PLR file. (If not there it will beginautostart) beginautostart() // Look for auto0.g on the next loop ); } } + else + DEBUG_ECHOLNPGM("SD: No UI Detected."); } void CardReader::release() {