Skip to content

Commit

Permalink
Emulate M21 SD card response
Browse files Browse the repository at this point in the history
  • Loading branch information
bkerler authored and CZDanol committed Jan 27, 2025
1 parent 136fb25 commit ebe7455
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/Marlin/Marlin/src/core/language.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
#define MSG_SD_VOL_INIT_FAIL "volume.init failed"
#define MSG_SD_OPENROOT_FAIL "openRoot failed"
#define MSG_SD_CARD_OK "SD card ok"
#define MSG_SD_CARD_FAIL "No SD card"
#define MSG_SD_WORKDIR_FAIL "workDir open failed"
#define MSG_SD_OPEN_FILE_FAIL "open failed, File: "
#define MSG_SD_FILE_OPENED "File opened: "
Expand Down
7 changes: 6 additions & 1 deletion src/marlin_stubs/sdcard/M20-M30_M32-M34.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ void GcodeSuite::M20() {
* M21 - Initialize SD card
*/
void GcodeSuite::M21() {
// not necessary - empty implementation
// required for Octoprint / third party tools to simulate an inserted SD card when using USB
if (marlin_vars()->media_inserted) {
SERIAL_ECHOLNPGM(MSG_SD_CARD_OK);
} else {
SERIAL_ECHOLNPGM(MSG_SD_CARD_FAIL);
}
}

/**
Expand Down

0 comments on commit ebe7455

Please sign in to comment.