Hello,
I am trying to learn how Marlin reads from the SD and prints the GCODE files. I'm am a beginner with c++, I have gotten this far,
Selecting the file from the menu in menu_media.cpp
This goes to the openAndPrintFile() in cardreader.cpp
This sends the M23 command with the file name to open the file, followed by the M24 command to start printing from the file.
From M24_25.cpp
The startFileprint() in cardreader.cpp
this seems to set the sdprinting flag to true but that seems to be it, i could not find this flag getting picked up anywhere.
Any help would be appreciated.
I am trying to learn how Marlin reads from the SD and prints the GCODE files. I'm am a beginner with c++, I have gotten this far,
Selecting the file from the menu in menu_media.cpp
inline void sdcard_start_selected_file() { card.openAndPrintFile(card.filename); ui.return_to_status(); ui.reset_status(); }
This goes to the openAndPrintFile() in cardreader.cpp
void CardReader:: openAndPrintFile(const char *name) { char cmd[4 + strlen(name) + 1]; // Room for "M23 ", filename, and null extern const char M23_STR[]; sprintf_P(cmd, M23_STR, name); for (char *c = &cmd[4]; *c; c++) *c = tolower(*c); queue.enqueue_one_now(cmd); queue.enqueue_now_P(M24_STR); }
This sends the M23 command with the file name to open the file, followed by the M24 command to start printing from the file.
From M24_25.cpp
if (card.isFileOpen()) { card.startFileprint(); // SD card will now be read for commands startOrResumeJob(); // Start (or resume) the print job timer TERN_(POWER_LOSS_RECOVERY, recovery.prepare()); }
The startFileprint() in cardreader.cpp
void CardReader::startFileprint() { if (isMounted()) { flag.sdprinting = true; TERN_(SD_RESORT, flush_presort()); } }
this seems to set the sdprinting flag to true but that seems to be it, i could not find this flag getting picked up anywhere.
Any help would be appreciated.