SD card debugging

This commit is contained in:
Scott Lahteine 2020-09-04 13:50:08 -05:00 committed by Scott Lahteine
parent f7cb9455c8
commit c1d9e8d571

View File

@ -24,6 +24,8 @@
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
//#define DEBUG_CARDREADER
#include "cardreader.h" #include "cardreader.h"
#include "../MarlinCore.h" #include "../MarlinCore.h"
@ -51,6 +53,9 @@
#include "../feature/pause.h" #include "../feature/pause.h"
#endif #endif
#define DEBUG_OUT ENABLED(DEBUG_CARDREADER)
#include "../core/debug_out.h"
// public: // public:
card_flags_t CardReader::flag; card_flags_t CardReader::flag;
@ -405,6 +410,8 @@ void CardReader::manage_media() {
uint8_t stat = uint8_t(IS_SD_INSERTED()); uint8_t stat = uint8_t(IS_SD_INSERTED());
if (stat == prev_stat) return; if (stat == prev_stat) return;
DEBUG_ECHOLNPAIR("SD: Status changed from ", prev_stat, " to ", stat);
flag.workDirIsRoot = true; // Return to root on mount/release flag.workDirIsRoot = true; // Return to root on mount/release
if (ui.detected()) { if (ui.detected()) {
@ -431,12 +438,15 @@ void CardReader::manage_media() {
if (stat) { if (stat) {
TERN_(SDCARD_EEPROM_EMULATION, settings.first_load()); TERN_(SDCARD_EEPROM_EMULATION, settings.first_load());
if (old_stat == 2) // First mount? if (old_stat == 2) // First mount?
DEBUG_ECHOLNPGM("First mount.");
TERN(POWER_LOSS_RECOVERY, TERN(POWER_LOSS_RECOVERY,
recovery.check(), // Check for PLR file. (If not there it will beginautostart) recovery.check(), // Check for PLR file. (If not there it will beginautostart)
beginautostart() // Look for auto0.g on the next loop beginautostart() // Look for auto0.g on the next loop
); );
} }
} }
else
DEBUG_ECHOLNPGM("SD: No UI Detected.");
} }
void CardReader::release() { void CardReader::release() {