Selaa lähdekoodia

Adding M118 command to send text to serial

Allows the user to send text to the serial console in order to
communicate with a host - sending debuging information or action
commands, for example.  Text must begin with '//' and this is added if
it is not already present at the beginning of the string.
Ben Lye 8 vuotta sitten
vanhempi
commit
98d362c2da
2 muutettua tiedostoa jossa 13 lisäystä ja 1 poistoa
  1. 12
    0
      Marlin/Marlin_main.cpp
  2. 1
    1
      Marlin/gcode.cpp

+ 12
- 0
Marlin/Marlin_main.cpp Näytä tiedosto

@@ -130,6 +130,7 @@
130 130
  * M114 - Report current position.
131 131
  * M115 - Report capabilities. (Extended capabilities requires EXTENDED_CAPABILITIES_REPORT)
132 132
  * M117 - Display a message on the controller screen. (Requires an LCD)
133
+ * M118 - Display a message in the host console.
133 134
  * M119 - Report endstops status.
134 135
  * M120 - Enable endstops detection.
135 136
  * M121 - Disable endstops detection.
@@ -7992,6 +7993,14 @@ inline void gcode_M115() {
7992 7993
 inline void gcode_M117() { lcd_setstatus(parser.string_arg); }
7993 7994
 
7994 7995
 /**
7996
+ * M118: Display a message in the host console.
7997
+ */
7998
+inline void gcode_M118() {
7999
+  SERIAL_ECHO_START();
8000
+  SERIAL_ECHOLN(parser.string_arg);
8001
+}
8002
+
8003
+/**
7995 8004
  * M119: Output endstop states to serial output
7996 8005
  */
7997 8006
 inline void gcode_M119() { endstops.M119(); }
@@ -10758,6 +10767,9 @@ void process_next_command() {
10758 10767
       case 117: // M117: Set LCD message text, if possible
10759 10768
         gcode_M117();
10760 10769
         break;
10770
+      case 118: // M118: Display a message in the host console
10771
+        gcode_M118();
10772
+        break;
10761 10773
       case 119: // M119: Report endstop states
10762 10774
         gcode_M119();
10763 10775
         break;

+ 1
- 1
Marlin/gcode.cpp Näytä tiedosto

@@ -150,7 +150,7 @@ void GCodeParser::parse(char *p) {
150 150
   #endif
151 151
 
152 152
   // Only use string_arg for these M codes
153
-  if (letter == 'M') switch (codenum) { case 23: case 28: case 30: case 117: case 928: string_arg = p; return; default: break; }
153
+  if (letter == 'M') switch (codenum) { case 23: case 28: case 30: case 117: case 118: case 928: string_arg = p; return; default: break; }
154 154
 
155 155
   #if ENABLED(DEBUG_GCODE_PARSER)
156 156
     const bool debug = codenum == 800;

Loading…
Peruuta
Tallenna