Browse Source

CNC workspace planes for G5

According to LinuxCNC, G5 should throw an error if the current plane mode isn't XY.
Scott Lahteine 7 years ago
parent
commit
898f48e331
2 changed files with 15 additions and 5 deletions
  1. 14
    5
      Marlin/Marlin_main.cpp
  2. 1
    0
      Marlin/language.h

+ 14
- 5
Marlin/Marlin_main.cpp View File

@@ -3535,6 +3535,14 @@ inline void gcode_G4() {
3535 3535
   inline void gcode_G5() {
3536 3536
     if (IsRunning()) {
3537 3537
 
3538
+      #if ENABLED(CNC_WORKSPACE_PLANES)
3539
+        if (workspace_plane != PLANE_XY) {
3540
+          SERIAL_ERROR_START();
3541
+          SERIAL_ERRORLNPGM(MSG_ERR_BAD_PLANE_MODE);
3542
+          return;
3543
+        }
3544
+      #endif
3545
+
3538 3546
       gcode_get_destination();
3539 3547
 
3540 3548
       const float offset[] = {
@@ -12591,7 +12599,7 @@ void prepare_move_to_destination() {
12591 12599
     millis_t next_idle_ms = millis() + 200UL;
12592 12600
 
12593 12601
     #if N_ARC_CORRECTION > 1
12594
-      int8_t count = N_ARC_CORRECTION;
12602
+      int8_t arc_recalc_count = N_ARC_CORRECTION;
12595 12603
     #endif
12596 12604
 
12597 12605
     for (uint16_t i = 1; i < segments; i++) { // Iterate (segments-1) times
@@ -12603,7 +12611,7 @@ void prepare_move_to_destination() {
12603 12611
       }
12604 12612
 
12605 12613
       #if N_ARC_CORRECTION > 1
12606
-        if (--count) {
12614
+        if (--arc_recalc_count) {
12607 12615
           // Apply vector rotation matrix to previous r_P / 1
12608 12616
           const float r_new_Y = r_P * sin_T + r_Q * cos_T;
12609 12617
           r_P = r_P * cos_T - r_Q * sin_T;
@@ -12613,7 +12621,7 @@ void prepare_move_to_destination() {
12613 12621
       #endif
12614 12622
       {
12615 12623
         #if N_ARC_CORRECTION > 1
12616
-          count = N_ARC_CORRECTION;
12624
+          arc_recalc_count = N_ARC_CORRECTION;
12617 12625
         #endif
12618 12626
 
12619 12627
         // Arc correction to radius vector. Computed only every N_ARC_CORRECTION increments.
@@ -12643,8 +12651,9 @@ void prepare_move_to_destination() {
12643 12651
     // motion control system might still be processing the action and the real tool position
12644 12652
     // in any intermediate location.
12645 12653
     set_current_to_destination();
12646
-  }
12647
-#endif
12654
+  } // plan_arc
12655
+
12656
+#endif // ARC_SUPPORT
12648 12657
 
12649 12658
 #if ENABLED(BEZIER_CURVE_SUPPORT)
12650 12659
 

+ 1
- 0
Marlin/language.h View File

@@ -160,6 +160,7 @@
160 160
 #define MSG_ERR_MATERIAL_INDEX              "M145 S<index> out of range (0-1)"
161 161
 #define MSG_ERR_M355_NONE                   "No case light"
162 162
 #define MSG_ERR_M421_PARAMETERS             "M421 incorrect parameter usage"
163
+#define MSG_ERR_BAD_PLANE_MODE              "G5 requires XY plane mode"
163 164
 #define MSG_ERR_MESH_XY                     "Mesh point cannot be resolved"
164 165
 #define MSG_ERR_ARC_ARGS                    "G2/G3 bad parameters"
165 166
 #define MSG_ERR_PROTECTED_PIN               "Protected Pin"

Loading…
Cancel
Save