Scott Lahteine 7 роки тому
джерело
коміт
9b4aa5ea8b

+ 0
- 8
Marlin/src/Marlin.cpp Переглянути файл

@@ -215,10 +215,6 @@ static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL
215 215
   millis_t lastUpdateMillis;
216 216
 #endif
217 217
 
218
-#if ENABLED(CNC_WORKSPACE_PLANES)
219
-  static WorkspacePlane workspace_plane = PLANE_XY;
220
-#endif
221
-
222 218
 /**
223 219
  * ***************************************************************************
224 220
  * ******************************** FUNCTIONS ********************************
@@ -361,10 +357,6 @@ void suicide() {
361 357
  ***************** GCode Handlers *****************
362 358
  **************************************************/
363 359
 
364
-#if ENABLED(CNC_WORKSPACE_PLANES)
365
-  #include "gcode/geometry/G17-G19.h"
366
-#endif
367
-
368 360
 #if ENABLED(INCH_MODE_SUPPORT)
369 361
   #include "gcode/units/G20_G21.h"
370 362
 #endif

+ 0
- 8
Marlin/src/core/enum.h Переглянути файл

@@ -148,12 +148,4 @@ enum LCDViewAction {
148 148
   };
149 149
 #endif
150 150
 
151
-/**
152
- * Workspace planes only apply to G2/G3 moves
153
- * (and "canned cycles" - not a current feature)
154
- */
155
-#if ENABLED(CNC_WORKSPACE_PLANES)
156
-  enum WorkspacePlane { PLANE_XY, PLANE_ZX, PLANE_YZ };
157
-#endif
158
-
159 151
 #endif // __ENUM_H__

+ 7
- 6
Marlin/src/gcode/gcode.cpp Переглянути файл

@@ -48,6 +48,10 @@ bool GcodeSuite::axis_relative_modes[] = AXIS_RELATIVE_MODES;
48 48
   uint8_t GcodeSuite::host_keepalive_interval = DEFAULT_KEEPALIVE_INTERVAL;
49 49
 #endif
50 50
 
51
+#if ENABLED(CNC_WORKSPACE_PLANES)
52
+  GcodeSuite::WorkspacePlane GcodeSuite::workspace_plane = PLANE_XY;
53
+#endif
54
+
51 55
 /**
52 56
  * Set target_extruder from the T parameter or the active_extruder
53 57
  *
@@ -112,9 +116,6 @@ void GcodeSuite::dwell(millis_t time) {
112 116
 //
113 117
 // Placeholders for non-migrated codes
114 118
 //
115
-extern void gcode_G17();
116
-extern void gcode_G18();
117
-extern void gcode_G19();
118 119
 extern void gcode_G20();
119 120
 extern void gcode_G21();
120 121
 extern void gcode_G27();
@@ -318,13 +319,13 @@ void GcodeSuite::process_next_command() {
318 319
 
319 320
       #if ENABLED(CNC_WORKSPACE_PLANES)
320 321
         case 17: // G17: Select Plane XY
321
-          gcode_G17();
322
+          G17();
322 323
           break;
323 324
         case 18: // G18: Select Plane ZX
324
-          gcode_G18();
325
+          G18();
325 326
           break;
326 327
         case 19: // G19: Select Plane YZ
327
-          gcode_G19();
328
+          G19();
328 329
           break;
329 330
       #endif // CNC_WORKSPACE_PLANES
330 331
 

+ 9
- 0
Marlin/src/gcode/gcode.h Переглянути файл

@@ -256,6 +256,15 @@ public:
256 256
 
257 257
   static bool axis_relative_modes[];
258 258
 
259
+  #if ENABLED(CNC_WORKSPACE_PLANES)
260
+    /**
261
+     * Workspace planes only apply to G2/G3 moves
262
+     * (and "canned cycles" - not a current feature)
263
+     */
264
+    enum WorkspacePlane { PLANE_XY, PLANE_ZX, PLANE_YZ };
265
+    static WorkspacePlane workspace_plane;
266
+  #endif
267
+
259 268
   static millis_t previous_cmd_ms;
260 269
   FORCE_INLINE static void refresh_cmd_timeout() { previous_cmd_ms = millis(); }
261 270
 

Marlin/src/gcode/geometry/G17-G19.h → Marlin/src/gcode/geometry/G17-G19.cpp Переглянути файл

@@ -20,10 +20,25 @@
20 20
  *
21 21
  */
22 22
 
23
-void report_workspace_plane() {
23
+#include "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(CNC_WORKSPACE_PLANES)
26
+
27
+#include "../gcode.h"
28
+
29
+inline void report_workspace_plane() {
24 30
   SERIAL_ECHO_START();
25 31
   SERIAL_ECHOPGM("Workspace Plane ");
26
-  serialprintPGM(workspace_plane == PLANE_YZ ? PSTR("YZ\n") : workspace_plane == PLANE_ZX ? PSTR("ZX\n") : PSTR("XY\n"));
32
+  serialprintPGM(
33
+      gcode.workspace_plane == GcodeSuite::PLANE_YZ ? PSTR("YZ\n")
34
+    : gcode.workspace_plane == GcodeSuite::PLANE_ZX ? PSTR("ZX\n")
35
+                                                    : PSTR("XY\n")
36
+  );
37
+}
38
+
39
+inline void set_workspace_plane(const GcodeSuite::WorkspacePlane plane) {
40
+  gcode.workspace_plane = plane;
41
+  if (DEBUGGING(INFO)) report_workspace_plane();
27 42
 }
28 43
 
29 44
 /**
@@ -31,6 +46,8 @@ void report_workspace_plane() {
31 46
  * G18: Select Plane ZX
32 47
  * G19: Select Plane YZ
33 48
  */
34
-void gcode_G17() { workspace_plane = PLANE_XY; }
35
-void gcode_G18() { workspace_plane = PLANE_ZX; }
36
-void gcode_G19() { workspace_plane = PLANE_YZ; }
49
+void GcodeSuite::G17() { set_workspace_plane(PLANE_XY); }
50
+void GcodeSuite::G18() { set_workspace_plane(PLANE_ZX); }
51
+void GcodeSuite::G19() { set_workspace_plane(PLANE_YZ); }
52
+
53
+#endif // CNC_WORKSPACE_PLANES

+ 4
- 4
Marlin/src/gcode/motion/G2_G3.cpp Переглянути файл

@@ -50,10 +50,10 @@ void plan_arc(
50 50
 ) {
51 51
   #if ENABLED(CNC_WORKSPACE_PLANES)
52 52
     AxisEnum p_axis, q_axis, l_axis;
53
-    switch (workspace_plane) {
54
-      case PLANE_XY: p_axis = X_AXIS; q_axis = Y_AXIS; l_axis = Z_AXIS; break;
55
-      case PLANE_ZX: p_axis = Z_AXIS; q_axis = X_AXIS; l_axis = Y_AXIS; break;
56
-      case PLANE_YZ: p_axis = Y_AXIS; q_axis = Z_AXIS; l_axis = X_AXIS; break;
53
+    switch (gcode.workspace_plane) {
54
+      case GcodeSuite::PLANE_XY: p_axis = X_AXIS; q_axis = Y_AXIS; l_axis = Z_AXIS; break;
55
+      case GcodeSuite::PLANE_ZX: p_axis = Z_AXIS; q_axis = X_AXIS; l_axis = Y_AXIS; break;
56
+      case GcodeSuite::PLANE_YZ: p_axis = Y_AXIS; q_axis = Z_AXIS; l_axis = X_AXIS; break;
57 57
     }
58 58
   #else
59 59
     constexpr AxisEnum p_axis = X_AXIS, q_axis = Y_AXIS, l_axis = Z_AXIS;

Завантаження…
Відмінити
Зберегти