|
@@ -620,11 +620,20 @@ void get_command()
|
620
|
620
|
if(!card.sdprinting || serial_count!=0){
|
621
|
621
|
return;
|
622
|
622
|
}
|
623
|
|
- while( !card.eof() && buflen < BUFSIZE) {
|
|
623
|
+
|
|
624
|
+ //'#' stops reading from sd to the buffer prematurely, so procedural macro calls are possible
|
|
625
|
+ // if it occures, stop_buffering is triggered and the buffer is ran dry.
|
|
626
|
+ // this character _can_ occure in serial com, due to checksums. however, no checksums are used in sd printing
|
|
627
|
+
|
|
628
|
+ static bool stop_buffering=false;
|
|
629
|
+ if(buflen==0) stop_buffering=false;
|
|
630
|
+
|
|
631
|
+ while( !card.eof() && buflen < BUFSIZE && !stop_buffering) {
|
624
|
632
|
int16_t n=card.get();
|
625
|
|
- serial_char = (char)n;
|
|
633
|
+ serial_char = (char)n;
|
626
|
634
|
if(serial_char == '\n' ||
|
627
|
635
|
serial_char == '\r' ||
|
|
636
|
+ serial_char == '#' ||
|
628
|
637
|
(serial_char == ':' && comment_mode == false) ||
|
629
|
638
|
serial_count >= (MAX_CMD_SIZE - 1)||n==-1)
|
630
|
639
|
{
|
|
@@ -644,6 +653,9 @@ void get_command()
|
644
|
653
|
card.checkautostart(true);
|
645
|
654
|
|
646
|
655
|
}
|
|
656
|
+ if(serial_char=='#')
|
|
657
|
+ stop_buffering=true;
|
|
658
|
+
|
647
|
659
|
if(!serial_count)
|
648
|
660
|
{
|
649
|
661
|
comment_mode = false; //for new command
|