Kaynağa Gözat

Fix G92 for native workspace

Scott Lahteine 6 yıl önce
ebeveyn
işleme
e4466b55b5
1 değiştirilmiş dosya ile 19 ekleme ve 18 silme
  1. 19
    18
      Marlin/Marlin_main.cpp

+ 19
- 18
Marlin/Marlin_main.cpp Dosyayı Görüntüle

@@ -6270,10 +6270,8 @@ void home_all_axes() { gcode_G28(true); }
6270 6270
  * G92: Set current position to given X Y Z E
6271 6271
  */
6272 6272
 inline void gcode_G92() {
6273
-  bool didXYZ = false,
6274
-       didE = parser.seenval('E');
6275 6273
 
6276
-  if (!didE) stepper.synchronize();
6274
+  stepper.synchronize();
6277 6275
 
6278 6276
   #if ENABLED(CNC_COORDINATE_SYSTEMS)
6279 6277
     switch (parser.subcode) {
@@ -6298,24 +6296,27 @@ inline void gcode_G92() {
6298 6296
     #define IS_G92_0 true
6299 6297
   #endif
6300 6298
 
6299
+  bool didXYZ = false, didE = false;
6300
+
6301 6301
   if (IS_G92_0) LOOP_XYZE(i) {
6302 6302
     if (parser.seenval(axis_codes[i])) {
6303
-      #if IS_SCARA
6304
-        if (i != E_AXIS) didXYZ = true;
6305
-      #else
6306
-        #if HAS_POSITION_SHIFT
6307
-          const float p = current_position[i];
6308
-        #endif
6309
-        const float v = parser.value_axis_units((AxisEnum)i);
6310
-
6311
-        if (i != E_AXIS) {
6312
-          didXYZ = true;
6313
-          #if HAS_POSITION_SHIFT
6314
-            position_shift[i] += v - p; // Offset the coordinate space
6303
+      const float v = parser.value_axis_units((AxisEnum)i),
6304
+                  d = current_position[i] - v;
6305
+      if (d) {
6306
+        if (i == E_AXIS) didE = true; else didXYZ = true;
6307
+        #if IS_SCARA
6308
+          current_position[i] = v;        // For SCARA just set the position directly
6309
+        #elif HAS_POSITION_SHIFT
6310
+          if (i == E_AXIS)
6311
+            current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly
6312
+          else {
6313
+            position_shift[i] += d;       // Other axes simply offset the coordinate space
6315 6314
             update_software_endstops((AxisEnum)i);
6316
-          #endif
6317
-        }
6318
-      #endif
6315
+          }
6316
+        #else
6317
+          current_position[i] = v;        // Without workspaces revert to Marlin 1.0 behavior
6318
+        #endif
6319
+      }
6319 6320
     }
6320 6321
   }
6321 6322
 

Loading…
İptal
Kaydet