Explorar el Código

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

Thomas Moore hace 6 años
padre
commit
fc55f1da01
Se han modificado 1 ficheros con 13 adiciones y 3 borrados
  1. 13
    3
      Marlin/src/module/planner.cpp

+ 13
- 3
Marlin/src/module/planner.cpp Ver fichero

@@ -2544,9 +2544,14 @@ void Planner::_set_position_mm(const float &a, const float &b, const float &c, c
2544 2544
   #if ENABLED(DISTINCT_E_FACTORS)
2545 2545
     last_extruder = active_extruder;
2546 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 2555
   position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]);
2551 2556
   #if HAS_POSITION_FLOAT
2552 2557
     position_float[A_AXIS] = a;
@@ -2588,6 +2593,11 @@ void Planner::set_position_mm(const AxisEnum axis, const float &v) {
2588 2593
   #else
2589 2594
     const uint8_t axis_index = axis;
2590 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 2601
   position[axis] = LROUND(v * axis_steps_per_mm[axis_index]);
2592 2602
   #if HAS_POSITION_FLOAT
2593 2603
     position_float[axis] = v;

Loading…
Cancelar
Guardar