Quellcode durchsuchen

Update M666 for XYZ dual endstops

Scott Lahteine vor 6 Jahren
Ursprung
Commit
d6df0322c2
2 geänderte Dateien mit 32 neuen und 13 gelöschten Zeilen
  1. 31
    12
      Marlin/src/gcode/calibrate/M666.cpp
  2. 1
    1
      Marlin/src/gcode/gcode.h

+ 31
- 12
Marlin/src/gcode/calibrate/M666.cpp Datei anzeigen

@@ -59,30 +59,49 @@
59 59
     #endif
60 60
   }
61 61
 
62
-#elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS)
62
+#elif ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
63 63
 
64 64
   #include "../../module/endstops.h"
65 65
 
66 66
   /**
67
-   * M666: For a Dual Endstop setup, set offsets for any 2nd endstops.
67
+   * M666: Set Dual Endstops offsets for X, Y, and/or Z.
68
+   *       With no parameters report current offsets.
68 69
    */
69
-  void GcodeSuite::M666() {
70
-    SERIAL_ECHOPGM("Dual Endstop Adjustment (mm): ");
70
+  inline void gcode_M666() {
71
+    bool report = true;
71 72
     #if ENABLED(X_DUAL_ENDSTOPS)
72
-      if (parser.seen('X')) endstops.x_endstop_adj = parser.value_linear_units();
73
-      SERIAL_ECHOPAIR(" X", endstops.x_endstop_adj);
73
+      if (parser.seen('X')) {
74
+        endstops.x_endstop_adj = parser.value_linear_units();
75
+        report = false;
76
+      }
74 77
     #endif
75 78
     #if ENABLED(Y_DUAL_ENDSTOPS)
76
-      if (parser.seen('Y')) endstops.y_endstop_adj = parser.value_linear_units();
77
-      SERIAL_ECHOPAIR(" Y", endstops.y_endstop_adj);
79
+      if (parser.seen('Y')) {
80
+        endstops.y_endstop_adj = parser.value_linear_units();
81
+        report = false;
82
+      }
78 83
     #endif
79 84
     #if ENABLED(Z_DUAL_ENDSTOPS)
80
-      if (parser.seen('Z')) endstops.z_endstop_adj = parser.value_linear_units();
81
-      SERIAL_ECHOPAIR(" Z", endstops.z_endstop_adj);
85
+      if (parser.seen('Z')) {
86
+        endstops.z_endstop_adj = parser.value_linear_units();
87
+        report = false;
88
+      }
82 89
     #endif
83
-    SERIAL_EOL();
90
+    if (report) {
91
+      SERIAL_ECHOPGM("Dual Endstop Adjustment (mm): ");
92
+      #if ENABLED(X_DUAL_ENDSTOPS)
93
+        SERIAL_ECHOPAIR(" X", endstops.x_endstop_adj);
94
+      #endif
95
+      #if ENABLED(Y_DUAL_ENDSTOPS)
96
+        SERIAL_ECHOPAIR(" Y", endstops.y_endstop_adj);
97
+      #endif
98
+      #if ENABLED(Z_DUAL_ENDSTOPS)
99
+        SERIAL_ECHOPAIR(" Z", endstops.z_endstop_adj);
100
+      #endif
101
+      SERIAL_EOL();
102
+    }
84 103
   }
85 104
 
86
-#endif
105
+#endif // X_DUAL_ENDSTOPS || Y_DUAL_ENDSTOPS || Z_DUAL_ENDSTOPS
87 106
 
88 107
 #endif // DELTA || Z_DUAL_ENDSTOPS

+ 1
- 1
Marlin/src/gcode/gcode.h Datei anzeigen

@@ -201,7 +201,7 @@
201 201
  * M603 - Configure filament change: "M603 T<tool> U<unload_length> L<load_length>". (Requires ADVANCED_PAUSE_FEATURE)
202 202
  * M605 - Set Dual X-Carriage movement mode: "M605 S<mode> [X<x_offset>] [R<temp_offset>]". (Requires DUAL_X_CARRIAGE)
203 203
  * M665 - Set delta configurations: "M665 L<diagonal rod> R<delta radius> S<segments/s> A<rod A trim mm> B<rod B trim mm> C<rod C trim mm> I<tower A trim angle> J<tower B trim angle> K<tower C trim angle>" (Requires DELTA)
204
- * M666 - Set delta endstop adjustment. (Requires DELTA)
204
+ * M666 - Set/get offsets for delta (Requires DELTA) or dual endstops (Requires [XYZ]_DUAL_ENDSTOPS).
205 205
  * M701 - Load filament (requires FILAMENT_LOAD_UNLOAD_GCODES)
206 206
  * M702 - Unload filament (requires FILAMENT_LOAD_UNLOAD_GCODES)
207 207
  * M851 - Set Z probe's Z offset in current units. (Negative = below the nozzle.)

Laden…
Abbrechen
Speichern