parent
0d342bac51
commit
5296af94d2
@ -491,8 +491,7 @@ void GCodeQueue::get_serial_commands() {
|
|||||||
* can also interrupt buffering.
|
* can also interrupt buffering.
|
||||||
*/
|
*/
|
||||||
inline void GCodeQueue::get_sdcard_commands() {
|
inline void GCodeQueue::get_sdcard_commands() {
|
||||||
static bool stop_buffering = false,
|
static bool sd_comment_mode = false
|
||||||
sd_comment_mode = false
|
|
||||||
#if ENABLED(PAREN_COMMENTS)
|
#if ENABLED(PAREN_COMMENTS)
|
||||||
, sd_comment_paren_mode = false
|
, sd_comment_paren_mode = false
|
||||||
#endif
|
#endif
|
||||||
@ -500,29 +499,13 @@ void GCodeQueue::get_serial_commands() {
|
|||||||
|
|
||||||
if (!IS_SD_PRINTING()) return;
|
if (!IS_SD_PRINTING()) return;
|
||||||
|
|
||||||
/**
|
|
||||||
* '#' stops reading from SD to the buffer prematurely, so procedural
|
|
||||||
* macro calls are possible. If it occurs, stop_buffering is triggered
|
|
||||||
* and the buffer is run dry; this character _can_ occur in serial com
|
|
||||||
* due to checksums, however, no checksums are used in SD printing.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (length == 0) stop_buffering = false;
|
|
||||||
|
|
||||||
uint16_t sd_count = 0;
|
uint16_t sd_count = 0;
|
||||||
bool card_eof = card.eof();
|
bool card_eof = card.eof();
|
||||||
while (length < BUFSIZE && !card_eof && !stop_buffering) {
|
while (length < BUFSIZE && !card_eof) {
|
||||||
const int16_t n = card.get();
|
const int16_t n = card.get();
|
||||||
char sd_char = (char)n;
|
char sd_char = (char)n;
|
||||||
card_eof = card.eof();
|
card_eof = card.eof();
|
||||||
if (card_eof || n == -1
|
if (card_eof || n == -1 || sd_char == '\n' || sd_char == '\r') {
|
||||||
|| sd_char == '\n' || sd_char == '\r'
|
|
||||||
|| ((sd_char == '#' || sd_char == ':') && !sd_comment_mode
|
|
||||||
#if ENABLED(PAREN_COMMENTS)
|
|
||||||
&& !sd_comment_paren_mode
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
if (card_eof) {
|
if (card_eof) {
|
||||||
|
|
||||||
card.printingHasFinished();
|
card.printingHasFinished();
|
||||||
@ -548,8 +531,6 @@ void GCodeQueue::get_serial_commands() {
|
|||||||
else if (n == -1)
|
else if (n == -1)
|
||||||
SERIAL_ERROR_MSG(MSG_SD_ERR_READ);
|
SERIAL_ERROR_MSG(MSG_SD_ERR_READ);
|
||||||
|
|
||||||
if (sd_char == '#') stop_buffering = true;
|
|
||||||
|
|
||||||
sd_comment_mode = false; // for new command
|
sd_comment_mode = false; // for new command
|
||||||
#if ENABLED(PAREN_COMMENTS)
|
#if ENABLED(PAREN_COMMENTS)
|
||||||
sd_comment_paren_mode = false;
|
sd_comment_paren_mode = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user