Browse Source

Use sync_plan_position_delta where needed

Scott Lahteine 9 years ago
parent
commit
bfccf26294
1 changed files with 52 additions and 18 deletions
  1. 52
    18
      Marlin/Marlin_main.cpp

+ 52
- 18
Marlin/Marlin_main.cpp View File

@@ -2035,7 +2035,12 @@ static void setup_for_endstop_move() {
2035 2035
 
2036 2036
       // Get the current stepper position after bumping an endstop
2037 2037
       current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
2038
-      sync_plan_position();
2038
+
2039
+      #if ENABLED(SCARA)
2040
+        sync_plan_position_delta();
2041
+      #else
2042
+        sync_plan_position();
2043
+      #endif
2039 2044
 
2040 2045
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2041 2046
         if (DEBUGGING(LEVELING)) DEBUG_POS("run_z_probe", current_position);
@@ -2079,7 +2084,11 @@ static void setup_for_endstop_move() {
2079 2084
           if (DEBUGGING(LEVELING)) DEBUG_POS("<<< set_bed_level_equation_lsq", corrected_position);
2080 2085
         #endif
2081 2086
 
2082
-        sync_plan_position();
2087
+        #if ENABLED(SCARA)
2088
+          sync_plan_position_delta();
2089
+        #else
2090
+          sync_plan_position();
2091
+        #endif
2083 2092
       }
2084 2093
 
2085 2094
     #endif // !DELTA
@@ -2119,7 +2128,11 @@ static void setup_for_endstop_move() {
2119 2128
         if (DEBUGGING(LEVELING)) DEBUG_POS("set_bed_level_equation_3pts", corrected_position);
2120 2129
       #endif
2121 2130
 
2122
-      sync_plan_position();
2131
+      #if ENABLED(DELTA) || ENABLED(SCARA)
2132
+        sync_plan_position_delta();
2133
+      #else
2134
+        sync_plan_position();
2135
+      #endif
2123 2136
     }
2124 2137
 
2125 2138
   #endif // !AUTO_BED_LEVELING_GRID
@@ -2321,7 +2334,11 @@ static void homeaxis(AxisEnum axis) {
2321 2334
 
2322 2335
     // Set the axis position as setup for the move
2323 2336
     current_position[axis] = 0;
2324
-    sync_plan_position();
2337
+    #if ENABLED(DELTA) || ENABLED(SCARA)
2338
+      sync_plan_position_delta();
2339
+    #else
2340
+      sync_plan_position();
2341
+    #endif
2325 2342
 
2326 2343
     // Homing Z towards the bed? Deploy the Z probe or endstop.
2327 2344
     #if HAS_BED_PROBE
@@ -2346,7 +2363,11 @@ static void homeaxis(AxisEnum axis) {
2346 2363
 
2347 2364
     // Set the axis position as setup for the move
2348 2365
     current_position[axis] = 0;
2349
-    sync_plan_position();
2366
+    #if ENABLED(DELTA) || ENABLED(SCARA)
2367
+      sync_plan_position_delta();
2368
+    #else
2369
+      sync_plan_position();
2370
+    #endif
2350 2371
 
2351 2372
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2352 2373
       if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(false)");
@@ -2407,7 +2428,7 @@ static void homeaxis(AxisEnum axis) {
2407 2428
           if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(false)");
2408 2429
         #endif
2409 2430
         endstops.enable(false); // Disable endstops while moving away
2410
-        sync_plan_position();
2431
+        sync_plan_position_delta();
2411 2432
         destination[axis] = endstop_adj[axis];
2412 2433
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2413 2434
           if (DEBUGGING(LEVELING)) {
@@ -2434,7 +2455,12 @@ static void homeaxis(AxisEnum axis) {
2434 2455
 
2435 2456
     // Set the axis position to its home position (plus home offsets)
2436 2457
     set_axis_is_at_home(axis);
2437
-    sync_plan_position();
2458
+
2459
+    #if ENABLED(DELTA) || ENABLED(SCARA)
2460
+      sync_plan_position_delta();
2461
+    #else
2462
+      sync_plan_position();
2463
+    #endif
2438 2464
 
2439 2465
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2440 2466
       if (DEBUGGING(LEVELING)) DEBUG_POS("> AFTER set_axis_is_at_home", current_position);
@@ -2485,7 +2511,7 @@ static void homeaxis(AxisEnum axis) {
2485 2511
 
2486 2512
       if (retract_zlift > 0.01) {
2487 2513
         current_position[Z_AXIS] -= retract_zlift;
2488
-        #if ENABLED(DELTA)
2514
+        #if ENABLED(DELTA) || ENABLED(SCARA)
2489 2515
           sync_plan_position_delta();
2490 2516
         #else
2491 2517
           sync_plan_position();
@@ -2497,7 +2523,7 @@ static void homeaxis(AxisEnum axis) {
2497 2523
 
2498 2524
       if (retract_zlift > 0.01) {
2499 2525
         current_position[Z_AXIS] += retract_zlift;
2500
-        #if ENABLED(DELTA)
2526
+        #if ENABLED(DELTA) || ENABLED(SCARA)
2501 2527
           sync_plan_position_delta();
2502 2528
         #else
2503 2529
           sync_plan_position();
@@ -3056,13 +3082,13 @@ inline void gcode_G28() {
3056 3082
 
3057 3083
     #endif // Z_HOME_DIR < 0
3058 3084
 
3059
-    sync_plan_position();
3060
-
3061
-  #endif // else DELTA
3085
+    #if ENABLED(SCARA)
3086
+      sync_plan_position_delta();
3087
+    #else
3088
+      sync_plan_position();
3089
+    #endif
3062 3090
 
3063
-  #if ENABLED(SCARA)
3064
-    sync_plan_position_delta();
3065
-  #endif
3091
+  #endif // !DELTA (gcode_G28)
3066 3092
 
3067 3093
   #if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
3068 3094
     endstops.enable(false);
@@ -3470,7 +3496,11 @@ inline void gcode_G28() {
3470 3496
           if (DEBUGGING(LEVELING)) DEBUG_POS("AFTER matrix.set_to_identity", uncorrected_position);
3471 3497
         #endif
3472 3498
 
3473
-        sync_plan_position();
3499
+        #if ENABLED(SCARA)
3500
+          sync_plan_position_delta();
3501
+        #else
3502
+          sync_plan_position();
3503
+        #endif
3474 3504
 
3475 3505
       #endif // !DELTA
3476 3506
     }
@@ -3788,7 +3818,11 @@ inline void gcode_G28() {
3788 3818
           #endif
3789 3819
         ;
3790 3820
         // current_position[Z_AXIS] += home_offset[Z_AXIS]; // The Z probe determines Z=0, not "Z home"
3791
-        sync_plan_position();
3821
+        #if ENABLED(SCARA)
3822
+          sync_plan_position_delta();
3823
+        #else
3824
+          sync_plan_position();
3825
+        #endif
3792 3826
 
3793 3827
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3794 3828
           if (DEBUGGING(LEVELING)) DEBUG_POS("> corrected Z in G29", current_position);
@@ -6707,7 +6741,7 @@ inline void gcode_T(uint8_t tmp_extruder) {
6707 6741
       #endif // !DUAL_X_CARRIAGE
6708 6742
 
6709 6743
       // Tell the planner the new "current position"
6710
-      #if ENABLED(DELTA)
6744
+      #if ENABLED(DELTA) || ENABLED(SCARA)
6711 6745
         sync_plan_position_delta();
6712 6746
       #else
6713 6747
         sync_plan_position();

Loading…
Cancel
Save