🩹 Report M22 / M23 success / fail (#24706)

This commit is contained in:
Arkadiusz Miśkiewicz 2022-09-01 20:48:24 +02:00 committed by Scott Lahteine
parent 53564fb6f3
commit 7daff755f2
2 changed files with 9 additions and 8 deletions

View File

@ -174,6 +174,7 @@
#define STR_SD_VOL_INIT_FAIL "volume.init failed"
#define STR_SD_OPENROOT_FAIL "openRoot failed"
#define STR_SD_CARD_OK "SD card ok"
#define STR_SD_CARD_RELEASED "SD card released"
#define STR_SD_WORKDIR_FAIL "workDir open failed"
#define STR_SD_OPEN_FILE_FAIL "open failed, File: "
#define STR_SD_FILE_OPENED "File opened: "

View File

@ -547,6 +547,7 @@ void CardReader::release() {
#if ALL(SDCARD_SORT_ALPHA, SDSORT_USES_RAM, SDSORT_CACHE_NAMES)
nrFiles = 0;
#endif
SERIAL_ECHO_MSG(STR_SD_CARD_RELEASED);
}
/**
@ -642,7 +643,7 @@ void announceOpen(const uint8_t doing, const char * const path) {
// - 2 : Resuming from a sub-procedure
//
void CardReader::openFileRead(const char * const path, const uint8_t subcall_type/*=0*/) {
if (!isMounted()) return;
if (!isMounted()) return openFailed(path);
switch (subcall_type) {
case 0: // Starting a new print. "Now fresh file: ..."
@ -684,7 +685,7 @@ void CardReader::openFileRead(const char * const path, const uint8_t subcall_typ
SdFile *diveDir;
const char * const fname = diveToFile(true, diveDir, path);
if (!fname) return;
if (!fname) return openFailed(path);
if (file.open(diveDir, fname, O_READ)) {
filesize = file.fileSize();
@ -720,21 +721,20 @@ void CardReader::openFileWrite(const char * const path) {
SdFile *diveDir;
const char * const fname = diveToFile(false, diveDir, path);
if (!fname) return;
if (!fname) return openFailed(path);
#if ENABLED(SDCARD_READONLY)
openFailed(fname);
#else
#if DISABLED(SDCARD_READONLY)
if (file.open(diveDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) {
flag.saving = true;
selectFileByName(fname);
TERN_(EMERGENCY_PARSER, emergency_parser.disable());
echo_write_to_file(fname);
ui.set_status(fname);
return;
}
else
openFailed(fname);
#endif
openFailed(fname);
}
//