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
 
2035
 
2036
       // Get the current stepper position after bumping an endstop
2036
       // Get the current stepper position after bumping an endstop
2037
       current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
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
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2045
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2041
         if (DEBUGGING(LEVELING)) DEBUG_POS("run_z_probe", current_position);
2046
         if (DEBUGGING(LEVELING)) DEBUG_POS("run_z_probe", current_position);
2079
           if (DEBUGGING(LEVELING)) DEBUG_POS("<<< set_bed_level_equation_lsq", corrected_position);
2084
           if (DEBUGGING(LEVELING)) DEBUG_POS("<<< set_bed_level_equation_lsq", corrected_position);
2080
         #endif
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
     #endif // !DELTA
2094
     #endif // !DELTA
2119
         if (DEBUGGING(LEVELING)) DEBUG_POS("set_bed_level_equation_3pts", corrected_position);
2128
         if (DEBUGGING(LEVELING)) DEBUG_POS("set_bed_level_equation_3pts", corrected_position);
2120
       #endif
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
   #endif // !AUTO_BED_LEVELING_GRID
2138
   #endif // !AUTO_BED_LEVELING_GRID
2321
 
2334
 
2322
     // Set the axis position as setup for the move
2335
     // Set the axis position as setup for the move
2323
     current_position[axis] = 0;
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
     // Homing Z towards the bed? Deploy the Z probe or endstop.
2343
     // Homing Z towards the bed? Deploy the Z probe or endstop.
2327
     #if HAS_BED_PROBE
2344
     #if HAS_BED_PROBE
2346
 
2363
 
2347
     // Set the axis position as setup for the move
2364
     // Set the axis position as setup for the move
2348
     current_position[axis] = 0;
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
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2372
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2352
       if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(false)");
2373
       if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(false)");
2407
           if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(false)");
2428
           if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(false)");
2408
         #endif
2429
         #endif
2409
         endstops.enable(false); // Disable endstops while moving away
2430
         endstops.enable(false); // Disable endstops while moving away
2410
-        sync_plan_position();
2431
+        sync_plan_position_delta();
2411
         destination[axis] = endstop_adj[axis];
2432
         destination[axis] = endstop_adj[axis];
2412
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2433
         #if ENABLED(DEBUG_LEVELING_FEATURE)
2413
           if (DEBUGGING(LEVELING)) {
2434
           if (DEBUGGING(LEVELING)) {
2434
 
2455
 
2435
     // Set the axis position to its home position (plus home offsets)
2456
     // Set the axis position to its home position (plus home offsets)
2436
     set_axis_is_at_home(axis);
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
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2465
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2440
       if (DEBUGGING(LEVELING)) DEBUG_POS("> AFTER set_axis_is_at_home", current_position);
2466
       if (DEBUGGING(LEVELING)) DEBUG_POS("> AFTER set_axis_is_at_home", current_position);
2485
 
2511
 
2486
       if (retract_zlift > 0.01) {
2512
       if (retract_zlift > 0.01) {
2487
         current_position[Z_AXIS] -= retract_zlift;
2513
         current_position[Z_AXIS] -= retract_zlift;
2488
-        #if ENABLED(DELTA)
2514
+        #if ENABLED(DELTA) || ENABLED(SCARA)
2489
           sync_plan_position_delta();
2515
           sync_plan_position_delta();
2490
         #else
2516
         #else
2491
           sync_plan_position();
2517
           sync_plan_position();
2497
 
2523
 
2498
       if (retract_zlift > 0.01) {
2524
       if (retract_zlift > 0.01) {
2499
         current_position[Z_AXIS] += retract_zlift;
2525
         current_position[Z_AXIS] += retract_zlift;
2500
-        #if ENABLED(DELTA)
2526
+        #if ENABLED(DELTA) || ENABLED(SCARA)
2501
           sync_plan_position_delta();
2527
           sync_plan_position_delta();
2502
         #else
2528
         #else
2503
           sync_plan_position();
2529
           sync_plan_position();
3056
 
3082
 
3057
     #endif // Z_HOME_DIR < 0
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
   #if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
3093
   #if ENABLED(ENDSTOPS_ONLY_FOR_HOMING)
3068
     endstops.enable(false);
3094
     endstops.enable(false);
3470
           if (DEBUGGING(LEVELING)) DEBUG_POS("AFTER matrix.set_to_identity", uncorrected_position);
3496
           if (DEBUGGING(LEVELING)) DEBUG_POS("AFTER matrix.set_to_identity", uncorrected_position);
3471
         #endif
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
       #endif // !DELTA
3505
       #endif // !DELTA
3476
     }
3506
     }
3788
           #endif
3818
           #endif
3789
         ;
3819
         ;
3790
         // current_position[Z_AXIS] += home_offset[Z_AXIS]; // The Z probe determines Z=0, not "Z home"
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
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3827
         #if ENABLED(DEBUG_LEVELING_FEATURE)
3794
           if (DEBUGGING(LEVELING)) DEBUG_POS("> corrected Z in G29", current_position);
3828
           if (DEBUGGING(LEVELING)) DEBUG_POS("> corrected Z in G29", current_position);
6707
       #endif // !DUAL_X_CARRIAGE
6741
       #endif // !DUAL_X_CARRIAGE
6708
 
6742
 
6709
       // Tell the planner the new "current position"
6743
       // Tell the planner the new "current position"
6710
-      #if ENABLED(DELTA)
6744
+      #if ENABLED(DELTA) || ENABLED(SCARA)
6711
         sync_plan_position_delta();
6745
         sync_plan_position_delta();
6712
       #else
6746
       #else
6713
         sync_plan_position();
6747
         sync_plan_position();

Loading…
Cancel
Save