|
@@ -491,8 +491,7 @@ void GCodeQueue::get_serial_commands() {
|
491
|
491
|
* can also interrupt buffering.
|
492
|
492
|
*/
|
493
|
493
|
inline void GCodeQueue::get_sdcard_commands() {
|
494
|
|
- static bool stop_buffering = false,
|
495
|
|
- sd_comment_mode = false
|
|
494
|
+ static bool sd_comment_mode = false
|
496
|
495
|
#if ENABLED(PAREN_COMMENTS)
|
497
|
496
|
, sd_comment_paren_mode = false
|
498
|
497
|
#endif
|
|
@@ -500,29 +499,13 @@ void GCodeQueue::get_serial_commands() {
|
500
|
499
|
|
501
|
500
|
if (!IS_SD_PRINTING()) return;
|
502
|
501
|
|
503
|
|
- /**
|
504
|
|
- * '#' stops reading from SD to the buffer prematurely, so procedural
|
505
|
|
- * macro calls are possible. If it occurs, stop_buffering is triggered
|
506
|
|
- * and the buffer is run dry; this character _can_ occur in serial com
|
507
|
|
- * due to checksums, however, no checksums are used in SD printing.
|
508
|
|
- */
|
509
|
|
-
|
510
|
|
- if (length == 0) stop_buffering = false;
|
511
|
|
-
|
512
|
502
|
uint16_t sd_count = 0;
|
513
|
503
|
bool card_eof = card.eof();
|
514
|
|
- while (length < BUFSIZE && !card_eof && !stop_buffering) {
|
|
504
|
+ while (length < BUFSIZE && !card_eof) {
|
515
|
505
|
const int16_t n = card.get();
|
516
|
506
|
char sd_char = (char)n;
|
517
|
507
|
card_eof = card.eof();
|
518
|
|
- if (card_eof || n == -1
|
519
|
|
- || sd_char == '\n' || sd_char == '\r'
|
520
|
|
- || ((sd_char == '#' || sd_char == ':') && !sd_comment_mode
|
521
|
|
- #if ENABLED(PAREN_COMMENTS)
|
522
|
|
- && !sd_comment_paren_mode
|
523
|
|
- #endif
|
524
|
|
- )
|
525
|
|
- ) {
|
|
508
|
+ if (card_eof || n == -1 || sd_char == '\n' || sd_char == '\r') {
|
526
|
509
|
if (card_eof) {
|
527
|
510
|
|
528
|
511
|
card.printingHasFinished();
|
|
@@ -548,8 +531,6 @@ void GCodeQueue::get_serial_commands() {
|
548
|
531
|
else if (n == -1)
|
549
|
532
|
SERIAL_ERROR_MSG(MSG_SD_ERR_READ);
|
550
|
533
|
|
551
|
|
- if (sd_char == '#') stop_buffering = true;
|
552
|
|
-
|
553
|
534
|
sd_comment_mode = false; // for new command
|
554
|
535
|
#if ENABLED(PAREN_COMMENTS)
|
555
|
536
|
sd_comment_paren_mode = false;
|