Ver código fonte

M218: report with no parameters

Scott Lahteine 7 anos atrás
pai
commit
5b45aab262
2 arquivos alterados com 27 adições e 15 exclusões
  1. 26
    14
      Marlin/src/gcode/config/M218.cpp
  2. 1
    1
      Marlin/src/gcode/gcode.h

+ 26
- 14
Marlin/src/gcode/config/M218.cpp Ver arquivo

@@ -38,26 +38,38 @@
38 38
 void GcodeSuite::M218() {
39 39
   if (get_target_extruder_from_command() || target_extruder == 0) return;
40 40
 
41
-  if (parser.seenval('X')) hotend_offset[X_AXIS][target_extruder] = parser.value_linear_units();
42
-  if (parser.seenval('Y')) hotend_offset[Y_AXIS][target_extruder] = parser.value_linear_units();
41
+  bool report = true;
42
+  if (parser.seenval('X')) {
43
+    hotend_offset[X_AXIS][target_extruder] = parser.value_linear_units();
44
+    report = false;
45
+  }
46
+  if (parser.seenval('Y')) {
47
+    hotend_offset[Y_AXIS][target_extruder] = parser.value_linear_units();
48
+    report = false;
49
+  }
43 50
 
44 51
   #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER)
45
-    if (parser.seenval('Z')) hotend_offset[Z_AXIS][target_extruder] = parser.value_linear_units();
52
+    if (parser.seenval('Z')) {
53
+      hotend_offset[Z_AXIS][target_extruder] = parser.value_linear_units();
54
+      report = false;
55
+    }
46 56
   #endif
47 57
 
48
-  SERIAL_ECHO_START();
49
-  SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
50
-  HOTEND_LOOP() {
51
-    SERIAL_CHAR(' ');
52
-    SERIAL_ECHO(hotend_offset[X_AXIS][e]);
53
-    SERIAL_CHAR(',');
54
-    SERIAL_ECHO(hotend_offset[Y_AXIS][e]);
55
-    #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER)
58
+  if (report) {
59
+    SERIAL_ECHO_START();
60
+    SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
61
+    HOTEND_LOOP() {
62
+      SERIAL_CHAR(' ');
63
+      SERIAL_ECHO(hotend_offset[X_AXIS][e]);
56 64
       SERIAL_CHAR(',');
57
-      SERIAL_ECHO(hotend_offset[Z_AXIS][e]);
58
-    #endif
65
+      SERIAL_ECHO(hotend_offset[Y_AXIS][e]);
66
+      #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_NOZZLE) || ENABLED(PARKING_EXTRUDER)
67
+        SERIAL_CHAR(',');
68
+        SERIAL_ECHO(hotend_offset[Z_AXIS][e]);
69
+      #endif
70
+    }
71
+    SERIAL_EOL();
59 72
   }
60
-  SERIAL_EOL();
61 73
 }
62 74
 
63 75
 #endif // HOTENDS > 1

+ 1
- 1
Marlin/src/gcode/gcode.h Ver arquivo

@@ -161,7 +161,7 @@
161 161
  * M209 - Turn Automatic Retract Detection on/off: S<0|1> (For slicers that don't support G10/11). (Requires FWRETRACT)
162 162
           Every normal extrude-only move will be classified as retract depending on the direction.
163 163
  * M211 - Enable, Disable, and/or Report software endstops: S<0|1> (Requires MIN_SOFTWARE_ENDSTOPS or MAX_SOFTWARE_ENDSTOPS)
164
- * M218 - Set a tool offset: "M218 T<index> X<offset> Y<offset>". (Requires 2 or more extruders)
164
+ * M218 - Set/get a tool offset: "M218 T<index> X<offset> Y<offset>". (Requires 2 or more extruders)
165 165
  * M220 - Set Feedrate Percentage: "M220 S<percent>" (i.e., "FR" on the LCD)
166 166
  * M221 - Set Flow Percentage: "M221 S<percent>"
167 167
  * M226 - Wait until a pin is in a given state: "M226 P<pin> S<state>"

Carregando…
Cancelar
Salvar