Przeglądaj źródła

Apply native workspace fixes to G92, G53-59

Scott Lahteine 7 lat temu
rodzic
commit
25ec0fecfa
1 zmienionych plików z 13 dodań i 11 usunięć
  1. 13
    11
      Marlin/Marlin_main.cpp

+ 13
- 11
Marlin/Marlin_main.cpp Wyświetl plik

3653
 #if ENABLED(CNC_COORDINATE_SYSTEMS)
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
    * System index -1 is used to specify machine-native.
3657
    * System index -1 is used to specify machine-native.
3658
    */
3658
    */
3659
   bool select_coordinate_system(const int8_t _new) {
3659
   bool select_coordinate_system(const int8_t _new) {
3664
     if (WITHIN(_new, 0, MAX_COORDINATE_SYSTEMS - 1))
3664
     if (WITHIN(_new, 0, MAX_COORDINATE_SYSTEMS - 1))
3665
       COPY(new_offset, coordinate_system[_new]);
3665
       COPY(new_offset, coordinate_system[_new]);
3666
     active_coordinate_system = _new;
3666
     active_coordinate_system = _new;
3667
-    bool didXYZ = false;
3668
     LOOP_XYZ(i) {
3667
     LOOP_XYZ(i) {
3669
       const float diff = new_offset[i] - old_offset[i];
3668
       const float diff = new_offset[i] - old_offset[i];
3670
       if (diff) {
3669
       if (diff) {
3671
         position_shift[i] += diff;
3670
         position_shift[i] += diff;
3672
         update_software_endstops((AxisEnum)i);
3671
         update_software_endstops((AxisEnum)i);
3673
-        didXYZ = true;
3674
       }
3672
       }
3675
     }
3673
     }
3676
-    if (didXYZ) SYNC_PLAN_POSITION_KINEMATIC();
3677
     return true;
3674
     return true;
3678
   }
3675
   }
3679
 
3676
 
6257
     #define IS_G92_0 true
6254
     #define IS_G92_0 true
6258
   #endif
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
   if (IS_G92_0) LOOP_XYZE(i) {
6264
   if (IS_G92_0) LOOP_XYZE(i) {
6263
     if (parser.seenval(axis_codes[i])) {
6265
     if (parser.seenval(axis_codes[i])) {
6265
                   v = i == E_AXIS ? l : LOGICAL_TO_NATIVE(l, i),
6267
                   v = i == E_AXIS ? l : LOGICAL_TO_NATIVE(l, i),
6266
                   d = v - current_position[i];
6268
                   d = v - current_position[i];
6267
       if (!NEAR_ZERO(d)) {
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
         #elif HAS_POSITION_SHIFT
6273
         #elif HAS_POSITION_SHIFT
6272
-          if (i == E_AXIS)
6274
+          if (i == E_AXIS) {
6275
+            didE = true;
6273
             current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly
6276
             current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly
6277
+          }
6274
           else {
6278
           else {
6275
             position_shift[i] += d;       // Other axes simply offset the coordinate space
6279
             position_shift[i] += d;       // Other axes simply offset the coordinate space
6276
             update_software_endstops((AxisEnum)i);
6280
             update_software_endstops((AxisEnum)i);
6277
           }
6281
           }
6278
-        #else
6279
-          current_position[i] = v;        // Without workspaces revert to Marlin 1.0 behavior
6280
         #endif
6282
         #endif
6281
       }
6283
       }
6282
     }
6284
     }

Ładowanie…
Anuluj
Zapisz