M808 Repeat Markers (#20084)
This commit is contained in:
@ -51,6 +51,10 @@ GCodeQueue queue;
|
||||
#include "../feature/powerloss.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(GCODE_REPEAT_MARKERS)
|
||||
#include "../feature/repeat.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* GCode line number handling. Hosts may opt to include line numbers when
|
||||
* sending commands to Marlin, and lines will be checked for sequentiality.
|
||||
@ -577,10 +581,9 @@ void GCodeQueue::get_serial_commands() {
|
||||
if (!IS_SD_PRINTING()) return;
|
||||
|
||||
int sd_count = 0;
|
||||
bool card_eof = card.eof();
|
||||
while (length < BUFSIZE && !card_eof) {
|
||||
while (length < BUFSIZE && !card.eof()) {
|
||||
const int16_t n = card.get();
|
||||
card_eof = card.eof();
|
||||
const bool card_eof = card.eof();
|
||||
if (n < 0 && !card_eof) { SERIAL_ERROR_MSG(STR_SD_ERR_READ); continue; }
|
||||
|
||||
const char sd_char = (char)n;
|
||||
@ -590,17 +593,21 @@ void GCodeQueue::get_serial_commands() {
|
||||
// Reset stream state, terminate the buffer, and commit a non-empty command
|
||||
if (!is_eol && sd_count) ++sd_count; // End of file with no newline
|
||||
if (!process_line_done(sd_input_state, command_buffer[index_w], sd_count)) {
|
||||
|
||||
// M808 S saves the sdpos of the next line. M808 loops to a new sdpos.
|
||||
TERN_(GCODE_REPEAT_MARKERS, repeat.early_parse_M808(command_buffer[index_w]));
|
||||
|
||||
// Put the new command into the buffer (no "ok" sent)
|
||||
_commit_command(false);
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
recovery.cmd_sdpos = card.getIndex(); // Prime for the NEXT _commit_command
|
||||
#endif
|
||||
|
||||
// Prime Power-Loss Recovery for the NEXT _commit_command
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.cmd_sdpos = card.getIndex());
|
||||
}
|
||||
|
||||
if (card_eof) card.fileHasFinished(); // Handle end of file reached
|
||||
if (card.eof()) card.fileHasFinished(); // Handle end of file reached
|
||||
}
|
||||
else
|
||||
process_stream_char(sd_char, sd_input_state, command_buffer[index_w], sd_count);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user