Browse Source

UBL/planner patch tweaks

Scott Lahteine 6 years ago
parent
commit
c93538e9f3
1 changed files with 14 additions and 16 deletions
  1. 14
    16
      Marlin/src/module/planner.cpp

+ 14
- 16
Marlin/src/module/planner.cpp View File

@@ -154,7 +154,7 @@ float Planner::e_factor[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0f); // The flow perc
154 154
 
155 155
 #if DISABLED(NO_VOLUMETRICS)
156 156
   float Planner::filament_size[EXTRUDERS],          // diameter of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder
157
-        Planner::volumetric_area_nominal = CIRCLE_AREA((float(DEFAULT_NOMINAL_FILAMENT_DIA)) * 0.5f), // Nominal cross-sectional area
157
+        Planner::volumetric_area_nominal = CIRCLE_AREA(float(DEFAULT_NOMINAL_FILAMENT_DIA) * 0.5f), // Nominal cross-sectional area
158 158
         Planner::volumetric_multiplier[EXTRUDERS];  // Reciprocal of cross-sectional area of filament (in mm^2). Pre-calculated to reduce computation in the planner
159 159
 #endif
160 160
 
@@ -2546,12 +2546,12 @@ void Planner::_set_position_mm(const float &a, const float &b, const float &c, c
2546 2546
   #endif
2547 2547
   position[A_AXIS] = LROUND(a * axis_steps_per_mm[A_AXIS]);
2548 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]);
2549
+  position[C_AXIS] = LROUND(axis_steps_per_mm[C_AXIS] * (c +
2550
+    #if !IS_KINEMATIC && ENABLED(AUTO_BED_LEVELING_UBL)
2551
+      leveling_active ? ubl.get_z_correction(a, b) :
2552
+    #endif
2553
+    0
2554
+  ));
2555 2555
   position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]);
2556 2556
   #if HAS_POSITION_FLOAT
2557 2557
     position_float[A_AXIS] = a;
@@ -2593,19 +2593,17 @@ void Planner::set_position_mm(const AxisEnum axis, const float &v) {
2593 2593
   #else
2594 2594
     const uint8_t axis_index = axis;
2595 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
2601
-  position[axis] = LROUND(v * axis_steps_per_mm[axis_index]);
2596
+  position[axis] = LROUND(axis_steps_per_mm[axis_index] * (v +
2597
+    #if ENABLED(AUTO_BED_LEVELING_UBL)
2598
+      axis == Z_AXIS && leveling_active ? ubl.get_z_correction(current_position[X_AXIS], current_position[Y_AXIS]) :
2599
+    #endif
2600
+    0
2601
+  ));
2602 2602
   #if HAS_POSITION_FLOAT
2603 2603
     position_float[axis] = v;
2604 2604
   #endif
2605
-  if (has_blocks_queued()) {
2606
-    //previous_speed[axis] = 0.0;
2605
+  if (has_blocks_queued())
2607 2606
     buffer_sync_block();
2608
-  }
2609 2607
   else
2610 2608
     stepper.set_position(axis, position[axis]);
2611 2609
 }

Loading…
Cancel
Save