Browse Source

Account for UBL correction when setting the planner position (#11486)

Thomas Moore 6 years ago
parent
commit
fc55f1da01
1 changed files with 13 additions and 3 deletions
  1. 13
    3
      Marlin/src/module/planner.cpp

+ 13
- 3
Marlin/src/module/planner.cpp View File

2544
   #if ENABLED(DISTINCT_E_FACTORS)
2544
   #if ENABLED(DISTINCT_E_FACTORS)
2545
     last_extruder = active_extruder;
2545
     last_extruder = active_extruder;
2546
   #endif
2546
   #endif
2547
-  position[A_AXIS] = LROUND(a * axis_steps_per_mm[A_AXIS]),
2548
-  position[B_AXIS] = LROUND(b * axis_steps_per_mm[B_AXIS]),
2549
-  position[C_AXIS] = LROUND(c * axis_steps_per_mm[C_AXIS]),
2547
+  position[A_AXIS] = LROUND(a * axis_steps_per_mm[A_AXIS]);
2548
+  position[B_AXIS] = LROUND(b * axis_steps_per_mm[B_AXIS]);
2549
+  #if !IS_KINEMATIC && ENABLED(AUTO_BED_LEVELING_UBL)
2550
+    if (leveling_active)
2551
+      position[C_AXIS] = LROUND((c + ubl.get_z_correction(a, b)) * axis_steps_per_mm[Z_AXIS]);
2552
+    else
2553
+  #endif
2554
+  position[C_AXIS] = LROUND(c * axis_steps_per_mm[C_AXIS]);
2550
   position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]);
2555
   position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]);
2551
   #if HAS_POSITION_FLOAT
2556
   #if HAS_POSITION_FLOAT
2552
     position_float[A_AXIS] = a;
2557
     position_float[A_AXIS] = a;
2588
   #else
2593
   #else
2589
     const uint8_t axis_index = axis;
2594
     const uint8_t axis_index = axis;
2590
   #endif
2595
   #endif
2596
+  #if ENABLED(AUTO_BED_LEVELING_UBL)
2597
+    if (axis == Z_AXIS && leveling_active)
2598
+      position[axis] = LROUND((v + ubl.get_z_correction(current_position[X_AXIS], current_position[Y_AXIS])) * axis_steps_per_mm[axis_index]);
2599
+    else
2600
+  #endif
2591
   position[axis] = LROUND(v * axis_steps_per_mm[axis_index]);
2601
   position[axis] = LROUND(v * axis_steps_per_mm[axis_index]);
2592
   #if HAS_POSITION_FLOAT
2602
   #if HAS_POSITION_FLOAT
2593
     position_float[axis] = v;
2603
     position_float[axis] = v;

Loading…
Cancel
Save