Przeglądaj źródła

UBL/planner patch tweaks

Scott Lahteine 6 lat temu
rodzic
commit
c93538e9f3
1 zmienionych plików z 14 dodań i 16 usunięć
  1. 14
    16
      Marlin/src/module/planner.cpp

+ 14
- 16
Marlin/src/module/planner.cpp Wyświetl plik

154
 
154
 
155
 #if DISABLED(NO_VOLUMETRICS)
155
 #if DISABLED(NO_VOLUMETRICS)
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
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
         Planner::volumetric_multiplier[EXTRUDERS];  // Reciprocal of cross-sectional area of filament (in mm^2). Pre-calculated to reduce computation in the planner
158
         Planner::volumetric_multiplier[EXTRUDERS];  // Reciprocal of cross-sectional area of filament (in mm^2). Pre-calculated to reduce computation in the planner
159
 #endif
159
 #endif
160
 
160
 
2546
   #endif
2546
   #endif
2547
   position[A_AXIS] = LROUND(a * axis_steps_per_mm[A_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]);
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
   position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]);
2555
   position[E_AXIS] = LROUND(e * axis_steps_per_mm[_EINDEX]);
2556
   #if HAS_POSITION_FLOAT
2556
   #if HAS_POSITION_FLOAT
2557
     position_float[A_AXIS] = a;
2557
     position_float[A_AXIS] = a;
2593
   #else
2593
   #else
2594
     const uint8_t axis_index = axis;
2594
     const uint8_t axis_index = axis;
2595
   #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
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
   #if HAS_POSITION_FLOAT
2602
   #if HAS_POSITION_FLOAT
2603
     position_float[axis] = v;
2603
     position_float[axis] = v;
2604
   #endif
2604
   #endif
2605
-  if (has_blocks_queued()) {
2606
-    //previous_speed[axis] = 0.0;
2605
+  if (has_blocks_queued())
2607
     buffer_sync_block();
2606
     buffer_sync_block();
2608
-  }
2609
   else
2607
   else
2610
     stepper.set_position(axis, position[axis]);
2608
     stepper.set_position(axis, position[axis]);
2611
 }
2609
 }

Ładowanie…
Anuluj
Zapisz