Browse Source

Fix G92.9 (thus PLR Z position) (#15625)

Robby Candra 5 years ago
parent
commit
cf8541a7a7
1 changed files with 6 additions and 15 deletions
  1. 6
    15
      Marlin/src/gcode/geometry/G92.cpp

+ 6
- 15
Marlin/src/gcode/geometry/G92.cpp View File

33
  */
33
  */
34
 void GcodeSuite::G92() {
34
 void GcodeSuite::G92() {
35
 
35
 
36
-  bool didE = false;
37
-  #if IS_SCARA || !HAS_POSITION_SHIFT
38
-    bool didXYZ = false;
39
-  #else
40
-    constexpr bool didXYZ = false;
41
-  #endif
36
+  bool sync_E = false, sync_XYZ = false;
42
 
37
 
43
   #if USE_GCODE_SUBCODES
38
   #if USE_GCODE_SUBCODES
44
     const uint8_t subcode_G92 = parser.subcode;
39
     const uint8_t subcode_G92 = parser.subcode;
64
         LOOP_XYZE(i) {
59
         LOOP_XYZE(i) {
65
           if (parser.seenval(axis_codes[i])) {
60
           if (parser.seenval(axis_codes[i])) {
66
             current_position[i] = parser.value_axis_units((AxisEnum)i);
61
             current_position[i] = parser.value_axis_units((AxisEnum)i);
67
-            #if IS_SCARA || !HAS_POSITION_SHIFT
68
-              if (i == E_AXIS) didE = true; else didXYZ = true;
69
-            #elif HAS_POSITION_SHIFT
70
-              if (i == E_AXIS) didE = true;
71
-            #endif
62
+            if (i == E_AXIS) sync_E = true; else sync_XYZ = true;
72
           }
63
           }
73
         }
64
         }
74
       } break;
65
       } break;
81
                       d = v - current_position[i];
72
                       d = v - current_position[i];
82
           if (!NEAR_ZERO(d)) {
73
           if (!NEAR_ZERO(d)) {
83
             #if IS_SCARA || !HAS_POSITION_SHIFT
74
             #if IS_SCARA || !HAS_POSITION_SHIFT
84
-              if (i == E_AXIS) didE = true; else didXYZ = true;
75
+              if (i == E_AXIS) sync_E = true; else sync_XYZ = true;
85
               current_position[i] = v;        // Without workspaces revert to Marlin 1.0 behavior
76
               current_position[i] = v;        // Without workspaces revert to Marlin 1.0 behavior
86
             #elif HAS_POSITION_SHIFT
77
             #elif HAS_POSITION_SHIFT
87
               if (i == E_AXIS) {
78
               if (i == E_AXIS) {
88
-                didE = true;
79
+                sync_E = true;
89
                 current_position.e = v; // When using coordinate spaces, only E is set directly
80
                 current_position.e = v; // When using coordinate spaces, only E is set directly
90
               }
81
               }
91
               else {
82
               else {
105
       coordinate_system[active_coordinate_system] = position_shift;
96
       coordinate_system[active_coordinate_system] = position_shift;
106
   #endif
97
   #endif
107
 
98
 
108
-  if    (didXYZ) sync_plan_position();
109
-  else if (didE) sync_plan_position_e();
99
+  if    (sync_XYZ) sync_plan_position();
100
+  else if (sync_E) sync_plan_position_e();
110
 
101
 
111
   report_current_position();
102
   report_current_position();
112
 }
103
 }

Loading…
Cancel
Save