浏览代码

CNC workspace planes for G5

According to LinuxCNC, G5 should throw an error if the current plane mode isn't XY.
Scott Lahteine 8 年前
父节点
当前提交
898f48e331
共有 2 个文件被更改,包括 15 次插入5 次删除
  1. 14
    5
      Marlin/Marlin_main.cpp
  2. 1
    0
      Marlin/language.h

+ 14
- 5
Marlin/Marlin_main.cpp 查看文件

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

+ 1
- 0
Marlin/language.h 查看文件

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

正在加载...
取消
保存