Signal SD completion later (#21840)

This commit is contained in:
Scott Lahteine
2021-05-08 04:35:35 -05:00
committed by Scott Lahteine
parent 83309c1ac8
commit c5c8ef436c
23 changed files with 133 additions and 116 deletions

View File

@ -550,7 +550,8 @@ void GCodeQueue::get_serial_commands() {
inline void GCodeQueue::get_sdcard_commands() {
static uint8_t sd_input_state = PS_NORMAL;
if (!IS_SD_PRINTING()) return;
// Get commands if there are more in the file
if (!IS_SD_FETCHING()) return;
int sd_count = 0;
while (!ring_buffer.full() && !card.eof()) {

View File

@ -25,6 +25,7 @@
#if ENABLED(SDSUPPORT)
#include "../gcode.h"
#include "../../module/planner.h"
#include "../../module/printcounter.h"
#if DISABLED(NO_SD_AUTOSTART)
@ -64,6 +65,11 @@
* M1001: Execute actions for SD print completion
*/
void GcodeSuite::M1001() {
planner.synchronize();
// SD Printing is finished when the queue reaches M1001
card.flag.sdprinting = card.flag.sdprintdone = false;
// If there's another auto#.g file to run...
if (TERN(NO_SD_AUTOSTART, false, card.autofile_check())) return;

View File

@ -70,7 +70,7 @@ void GcodeSuite::M24() {
#endif
if (card.isFileOpen()) {
card.startFileprint(); // SD card will now be read for commands
card.startOrResumeFilePrinting(); // SD card will now be read for commands
startOrResumeJob(); // Start (or resume) the print job timer
TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
}

View File

@ -35,7 +35,7 @@
void GcodeSuite::M27() {
if (parser.seen('C')) {
SERIAL_ECHOPGM("Current file: ");
card.printFilename();
card.printSelectedFilename();
return;
}

View File

@ -49,7 +49,7 @@ void GcodeSuite::M32() {
if (parser.seenval('S')) card.setIndex(parser.value_long());
card.startFileprint();
card.startOrResumeFilePrinting();
// Procedure calls count as normal print time.
if (!call_procedure) startOrResumeJob();

View File

@ -33,7 +33,7 @@
void GcodeSuite::M524() {
if (IS_SD_PRINTING())
card.flag.abort_sd_printing = true;
card.abortFilePrintSoon();
else if (card.isMounted())
card.closefile();