Browse Source

Hide M117 with no LCD

Scott Lahteine 10 years ago
parent
commit
ca79282eaf
1 changed files with 32 additions and 19 deletions
  1. 32
    19
      Marlin/Marlin_main.cpp

+ 32
- 19
Marlin/Marlin_main.cpp View File

740
       last_command_time = ms;
740
       last_command_time = ms;
741
     }
741
     }
742
   #endif
742
   #endif
743
-  
744
-  while (MYSERIAL.available() > 0 && commands_in_queue < BUFSIZE) {
743
+
744
+  //
745
+  // Loop while serial characters are incoming and the queue is not full
746
+  //
747
+  while (commands_in_queue < BUFSIZE && MYSERIAL.available() > 0) {
748
+
745
     #ifdef NO_TIMEOUTS
749
     #ifdef NO_TIMEOUTS
746
       last_command_time = ms;
750
       last_command_time = ms;
747
     #endif
751
     #endif
752
+
748
     serial_char = MYSERIAL.read();
753
     serial_char = MYSERIAL.read();
749
 
754
 
750
-    if (serial_char == '\n' || serial_char == '\r' ||
751
-       serial_count >= (MAX_CMD_SIZE - 1)
752
-    ) {
755
+    //
756
+    // If the character ends the line, or the line is full...
757
+    //
758
+    if (serial_char == '\n' || serial_char == '\r' || serial_count >= MAX_CMD_SIZE-1) {
759
+
753
       // end of line == end of comment
760
       // end of line == end of comment
754
       comment_mode = false;
761
       comment_mode = false;
755
 
762
 
756
-      if (!serial_count) return; // shortcut for empty lines
763
+      if (!serial_count) return; // empty lines just exit
757
 
764
 
758
       char *command = command_queue[cmd_queue_index_w];
765
       char *command = command_queue[cmd_queue_index_w];
759
       command[serial_count] = 0; // terminate string
766
       command[serial_count] = 0; // terminate string
760
 
767
 
768
+      // this item in the queue is not from sd
761
       #ifdef SDSUPPORT
769
       #ifdef SDSUPPORT
762
         fromsd[cmd_queue_index_w] = false;
770
         fromsd[cmd_queue_index_w] = false;
763
       #endif
771
       #endif
839
       serial_count = 0; //clear buffer
847
       serial_count = 0; //clear buffer
840
     }
848
     }
841
     else if (serial_char == '\\') {  // Handle escapes
849
     else if (serial_char == '\\') {  // Handle escapes
842
-      if (MYSERIAL.available() > 0  && commands_in_queue < BUFSIZE) {
850
+      if (MYSERIAL.available() > 0 && commands_in_queue < BUFSIZE) {
843
         // if we have one more character, copy it over
851
         // if we have one more character, copy it over
844
         serial_char = MYSERIAL.read();
852
         serial_char = MYSERIAL.read();
845
         command_queue[cmd_queue_index_w][serial_count++] = serial_char;
853
         command_queue[cmd_queue_index_w][serial_count++] = serial_char;
3854
   SERIAL_PROTOCOLPGM(MSG_M115_REPORT);
3862
   SERIAL_PROTOCOLPGM(MSG_M115_REPORT);
3855
 }
3863
 }
3856
 
3864
 
3857
-/**
3858
- * M117: Set LCD Status Message
3859
- */
3860
-inline void gcode_M117() {
3861
-  char* codepos = strchr_pointer + 5;
3862
-  char* starpos = strchr(codepos, '*');
3863
-  if (starpos) *starpos = '\0';
3864
-  lcd_setstatus(codepos);
3865
-}
3865
+#ifdef ULTIPANEL
3866
+
3867
+  /**
3868
+   * M117: Set LCD Status Message
3869
+   */
3870
+  inline void gcode_M117() {
3871
+    lcd_setstatus(strchr_pointer + 5);
3872
+  }
3873
+
3874
+#endif
3866
 
3875
 
3867
 /**
3876
 /**
3868
  * M119: Output endstop states to serial output
3877
  * M119: Output endstop states to serial output
5412
       case 115: // M115: Report capabilities
5421
       case 115: // M115: Report capabilities
5413
         gcode_M115();
5422
         gcode_M115();
5414
         break;
5423
         break;
5415
-      case 117: // M117: Set LCD message text
5416
-        gcode_M117();
5417
-        break;
5424
+
5425
+      #ifdef ULTIPANEL
5426
+        case 117: // M117: Set LCD message text
5427
+          gcode_M117();
5428
+          break;
5429
+      #endif
5430
+
5418
       case 114: // M114: Report current position
5431
       case 114: // M114: Report current position
5419
         gcode_M114();
5432
         gcode_M114();
5420
         break;
5433
         break;

Loading…
Cancel
Save