Sfoglia il codice sorgente

Apply native workspace fixes to G92, G53-59

Scott Lahteine 6 anni fa
parent
commit
25ec0fecfa
1 ha cambiato i file con 13 aggiunte e 11 eliminazioni
  1. 13
    11
      Marlin/Marlin_main.cpp

+ 13
- 11
Marlin/Marlin_main.cpp Vedi File

@@ -3653,7 +3653,7 @@ inline void gcode_G4() {
3653 3653
 #if ENABLED(CNC_COORDINATE_SYSTEMS)
3654 3654
 
3655 3655
   /**
3656
-   * Select a coordinate system and update the current position.
3656
+   * Select a coordinate system and update the workspace offset.
3657 3657
    * System index -1 is used to specify machine-native.
3658 3658
    */
3659 3659
   bool select_coordinate_system(const int8_t _new) {
@@ -3664,16 +3664,13 @@ inline void gcode_G4() {
3664 3664
     if (WITHIN(_new, 0, MAX_COORDINATE_SYSTEMS - 1))
3665 3665
       COPY(new_offset, coordinate_system[_new]);
3666 3666
     active_coordinate_system = _new;
3667
-    bool didXYZ = false;
3668 3667
     LOOP_XYZ(i) {
3669 3668
       const float diff = new_offset[i] - old_offset[i];
3670 3669
       if (diff) {
3671 3670
         position_shift[i] += diff;
3672 3671
         update_software_endstops((AxisEnum)i);
3673
-        didXYZ = true;
3674 3672
       }
3675 3673
     }
3676
-    if (didXYZ) SYNC_PLAN_POSITION_KINEMATIC();
3677 3674
     return true;
3678 3675
   }
3679 3676
 
@@ -6257,7 +6254,12 @@ inline void gcode_G92() {
6257 6254
     #define IS_G92_0 true
6258 6255
   #endif
6259 6256
 
6260
-  bool didXYZ = false, didE = false;
6257
+  bool didE = false;
6258
+  #if IS_SCARA || !HAS_POSITION_SHIFT
6259
+    bool didXYZ = false;
6260
+  #else
6261
+    constexpr bool didXYZ = false;
6262
+  #endif
6261 6263
 
6262 6264
   if (IS_G92_0) LOOP_XYZE(i) {
6263 6265
     if (parser.seenval(axis_codes[i])) {
@@ -6265,18 +6267,18 @@ inline void gcode_G92() {
6265 6267
                   v = i == E_AXIS ? l : LOGICAL_TO_NATIVE(l, i),
6266 6268
                   d = v - current_position[i];
6267 6269
       if (!NEAR_ZERO(d)) {
6268
-        if (i == E_AXIS) didE = true; else didXYZ = true;
6269
-        #if IS_SCARA
6270
-          current_position[i] = v;        // For SCARA just set the position directly
6270
+        #if IS_SCARA || !HAS_POSITION_SHIFT
6271
+          if (i == E_AXIS) didE = true; else didXYZ = true;
6272
+          current_position[i] = v;        // Without workspaces revert to Marlin 1.0 behavior
6271 6273
         #elif HAS_POSITION_SHIFT
6272
-          if (i == E_AXIS)
6274
+          if (i == E_AXIS) {
6275
+            didE = true;
6273 6276
             current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly
6277
+          }
6274 6278
           else {
6275 6279
             position_shift[i] += d;       // Other axes simply offset the coordinate space
6276 6280
             update_software_endstops((AxisEnum)i);
6277 6281
           }
6278
-        #else
6279
-          current_position[i] = v;        // Without workspaces revert to Marlin 1.0 behavior
6280 6282
         #endif
6281 6283
       }
6282 6284
     }

Loading…
Annulla
Salva