Browse Source

Merge pull request #2096 from thinkyhead/cherry_picking3

Hide M117 with no LCD
Scott Lahteine 10 years ago
parent
commit
273a4a253f
1 changed files with 32 additions and 19 deletions
  1. 32
    19
      Marlin/Marlin_main.cpp

+ 32
- 19
Marlin/Marlin_main.cpp View File

@@ -751,24 +751,32 @@ void get_command() {
751 751
       last_command_time = ms;
752 752
     }
753 753
   #endif
754
-  
755
-  while (MYSERIAL.available() > 0 && commands_in_queue < BUFSIZE) {
754
+
755
+  //
756
+  // Loop while serial characters are incoming and the queue is not full
757
+  //
758
+  while (commands_in_queue < BUFSIZE && MYSERIAL.available() > 0) {
759
+
756 760
     #ifdef NO_TIMEOUTS
757 761
       last_command_time = ms;
758 762
     #endif
763
+
759 764
     serial_char = MYSERIAL.read();
760 765
 
761
-    if (serial_char == '\n' || serial_char == '\r' ||
762
-       serial_count >= (MAX_CMD_SIZE - 1)
763
-    ) {
766
+    //
767
+    // If the character ends the line, or the line is full...
768
+    //
769
+    if (serial_char == '\n' || serial_char == '\r' || serial_count >= MAX_CMD_SIZE-1) {
770
+
764 771
       // end of line == end of comment
765 772
       comment_mode = false;
766 773
 
767
-      if (!serial_count) return; // shortcut for empty lines
774
+      if (!serial_count) return; // empty lines just exit
768 775
 
769 776
       char *command = command_queue[cmd_queue_index_w];
770 777
       command[serial_count] = 0; // terminate string
771 778
 
779
+      // this item in the queue is not from sd
772 780
       #ifdef SDSUPPORT
773 781
         fromsd[cmd_queue_index_w] = false;
774 782
       #endif
@@ -834,7 +842,7 @@ void get_command() {
834 842
       serial_count = 0; //clear buffer
835 843
     }
836 844
     else if (serial_char == '\\') {  // Handle escapes
837
-      if (MYSERIAL.available() > 0  && commands_in_queue < BUFSIZE) {
845
+      if (MYSERIAL.available() > 0 && commands_in_queue < BUFSIZE) {
838 846
         // if we have one more character, copy it over
839 847
         serial_char = MYSERIAL.read();
840 848
         command_queue[cmd_queue_index_w][serial_count++] = serial_char;
@@ -3849,15 +3857,16 @@ inline void gcode_M115() {
3849 3857
   SERIAL_PROTOCOLPGM(MSG_M115_REPORT);
3850 3858
 }
3851 3859
 
3852
-/**
3853
- * M117: Set LCD Status Message
3854
- */
3855
-inline void gcode_M117() {
3856
-  char* codepos = strchr_pointer + 5;
3857
-  char* starpos = strchr(codepos, '*');
3858
-  if (starpos) *starpos = '\0';
3859
-  lcd_setstatus(codepos);
3860
-}
3860
+#ifdef ULTIPANEL
3861
+
3862
+  /**
3863
+   * M117: Set LCD Status Message
3864
+   */
3865
+  inline void gcode_M117() {
3866
+    lcd_setstatus(strchr_pointer + 5);
3867
+  }
3868
+
3869
+#endif
3861 3870
 
3862 3871
 /**
3863 3872
  * M119: Output endstop states to serial output
@@ -5407,9 +5416,13 @@ void process_next_command() {
5407 5416
       case 115: // M115: Report capabilities
5408 5417
         gcode_M115();
5409 5418
         break;
5410
-      case 117: // M117: Set LCD message text
5411
-        gcode_M117();
5412
-        break;
5419
+
5420
+      #ifdef ULTIPANEL
5421
+        case 117: // M117: Set LCD message text
5422
+          gcode_M117();
5423
+          break;
5424
+      #endif
5425
+
5413 5426
       case 114: // M114: Report current position
5414 5427
         gcode_M114();
5415 5428
         break;

Loading…
Cancel
Save