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,24 +740,32 @@ void get_command() {
740 740
       last_command_time = ms;
741 741
     }
742 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 749
     #ifdef NO_TIMEOUTS
746 750
       last_command_time = ms;
747 751
     #endif
752
+
748 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 760
       // end of line == end of comment
754 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 765
       char *command = command_queue[cmd_queue_index_w];
759 766
       command[serial_count] = 0; // terminate string
760 767
 
768
+      // this item in the queue is not from sd
761 769
       #ifdef SDSUPPORT
762 770
         fromsd[cmd_queue_index_w] = false;
763 771
       #endif
@@ -839,7 +847,7 @@ void get_command() {
839 847
       serial_count = 0; //clear buffer
840 848
     }
841 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 851
         // if we have one more character, copy it over
844 852
         serial_char = MYSERIAL.read();
845 853
         command_queue[cmd_queue_index_w][serial_count++] = serial_char;
@@ -3854,15 +3862,16 @@ inline void gcode_M115() {
3854 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 3877
  * M119: Output endstop states to serial output
@@ -5412,9 +5421,13 @@ void process_commands() {
5412 5421
       case 115: // M115: Report capabilities
5413 5422
         gcode_M115();
5414 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 5431
       case 114: // M114: Report current position
5419 5432
         gcode_M114();
5420 5433
         break;

Loading…
Cancel
Save