Bläddra i källkod

Apply native workspace fixes for G92, G53-59

Scott Lahteine 7 år sedan
förälder
incheckning
2f73dec077
2 ändrade filer med 13 tillägg och 11 borttagningar
  1. 1
    4
      Marlin/src/gcode/geometry/G53-G59.cpp
  2. 12
    7
      Marlin/src/gcode/geometry/G92.cpp

+ 1
- 4
Marlin/src/gcode/geometry/G53-G59.cpp Visa fil

@@ -27,7 +27,7 @@
27 27
 #if ENABLED(CNC_COORDINATE_SYSTEMS)
28 28
 
29 29
   /**
30
-   * Select a coordinate system and update the current position.
30
+   * Select a coordinate system and update the workspace offset.
31 31
    * System index -1 is used to specify machine-native.
32 32
    */
33 33
   bool GCodeSuite::select_coordinate_system(const int8_t _new) {
@@ -39,16 +39,13 @@
39 39
     if (WITHIN(_new, 0, MAX_COORDINATE_SYSTEMS - 1))
40 40
       COPY(new_offset, coordinate_system[_new]);
41 41
     active_coordinate_system = _new;
42
-    bool didXYZ = false;
43 42
     LOOP_XYZ(i) {
44 43
       const float diff = new_offset[i] - old_offset[i];
45 44
       if (diff) {
46 45
         position_shift[i] += diff;
47 46
         update_software_endstops((AxisEnum)i);
48
-        didXYZ = true;
49 47
       }
50 48
     }
51
-    if (didXYZ) SYNC_PLAN_POSITION_KINEMATIC();
52 49
     return true;
53 50
   }
54 51
 

+ 12
- 7
Marlin/src/gcode/geometry/G92.cpp Visa fil

@@ -58,7 +58,12 @@ void GcodeSuite::G92() {
58 58
     #define IS_G92_0 true
59 59
   #endif
60 60
 
61
-  bool didXYZ = false, didE = false;
61
+  bool didE = false;
62
+  #if IS_SCARA || !HAS_POSITION_SHIFT
63
+    bool didXYZ = false;
64
+  #else
65
+    constexpr bool didXYZ = false;
66
+  #endif
62 67
 
63 68
   if (IS_G92_0) LOOP_XYZE(i) {
64 69
     if (parser.seenval(axis_codes[i])) {
@@ -66,18 +71,18 @@ void GcodeSuite::G92() {
66 71
                   v = i == E_AXIS ? l : LOGICAL_TO_NATIVE(l, i),
67 72
                   d = v - current_position[i];
68 73
       if (!NEAR_ZERO(d)) {
69
-        if (i == E_AXIS) didE = true; else didXYZ = true;
70
-        #if IS_SCARA
71
-          current_position[i] = v;        // For SCARA just set the position directly
74
+        #if IS_SCARA || !HAS_POSITION_SHIFT
75
+          if (i == E_AXIS) didE = true; else didXYZ = true;
76
+          current_position[i] = v;        // Without workspaces revert to Marlin 1.0 behavior
72 77
         #elif HAS_POSITION_SHIFT
73
-          if (i == E_AXIS)
78
+          if (i == E_AXIS) {
79
+            didE = true;
74 80
             current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly
81
+          }
75 82
           else {
76 83
             position_shift[i] += d;       // Other axes simply offset the coordinate space
77 84
             update_software_endstops((AxisEnum)i);
78 85
           }
79
-        #else
80
-          current_position[i] = v;        // Without workspaces revert to Marlin 1.0 behavior
81 86
         #endif
82 87
       }
83 88
     }

Laddar…
Avbryt
Spara