Quellcode durchsuchen

🩹 Arc/Planner optimization followup (#24509)

tombrazier vor 1 Jahr
Ursprung
Commit
3b4a5a1ae8
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden
2 geänderte Dateien mit 7 neuen und 5 gelöschten Zeilen
  1. 6
    4
      Marlin/src/gcode/motion/G2_G3.cpp
  2. 1
    1
      Marlin/src/module/planner.cpp

+ 6
- 4
Marlin/src/gcode/motion/G2_G3.cpp Datei anzeigen

@@ -294,11 +294,12 @@ void plan_arc(
294 294
     // An arc can always complete within limits from a speed which...
295 295
     // a) is <= any configured maximum speed,
296 296
     // b) does not require centripetal force greater than any configured maximum acceleration,
297
-    // c) allows the print head to stop in the remining length of the curve within all configured maximum accelerations.
297
+    // c) is <= nominal speed,
298
+    // d) allows the print head to stop in the remining length of the curve within all configured maximum accelerations.
298 299
     // The last has to be calculated every time through the loop.
299 300
     const float limiting_accel = _MIN(planner.settings.max_acceleration_mm_per_s2[axis_p], planner.settings.max_acceleration_mm_per_s2[axis_q]),
300 301
                 limiting_speed = _MIN(planner.settings.max_feedrate_mm_s[axis_p], planner.settings.max_acceleration_mm_per_s2[axis_q]),
301
-                limiting_speed_sqr = _MIN(sq(limiting_speed), limiting_accel * radius);
302
+                limiting_speed_sqr = _MIN(sq(limiting_speed), limiting_accel * radius, sq(scaled_fr_mm_s));
302 303
     float arc_mm_remaining = flat_mm;
303 304
 
304 305
     for (uint16_t i = 1; i < segments; i++) { // Iterate (segments-1) times
@@ -357,12 +358,12 @@ void plan_arc(
357 358
 
358 359
       // calculate safe speed for stopping by the end of the arc
359 360
       arc_mm_remaining -= segment_mm;
360
-
361
-      hints.curve_radius = i > 1 ? radius : 0;
362 361
       hints.safe_exit_speed_sqr = _MIN(limiting_speed_sqr, 2 * limiting_accel * arc_mm_remaining);
363 362
 
364 363
       if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, hints))
365 364
         break;
365
+
366
+      hints.curve_radius = radius;
366 367
     }
367 368
   }
368 369
 
@@ -383,6 +384,7 @@ void plan_arc(
383 384
   #endif
384 385
 
385 386
   hints.curve_radius = 0;
387
+  hints.safe_exit_speed_sqr = 0.0f;
386 388
   planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, hints);
387 389
 
388 390
   #if ENABLED(AUTO_BED_LEVELING_UBL)

+ 1
- 1
Marlin/src/module/planner.cpp Datei anzeigen

@@ -806,7 +806,7 @@ void Planner::calculate_trapezoid_for_block(block_t * const block, const_float_t
806 806
     float accelerate_steps_float = (nominal_rate_sq - sq(float(initial_rate))) * (0.5f / accel);
807 807
     accelerate_steps = CEIL(accelerate_steps_float);
808 808
     const float decelerate_steps_float = (nominal_rate_sq - sq(float(final_rate))) * (0.5f / accel);
809
-    decelerate_steps = decelerate_steps_float;
809
+    decelerate_steps = FLOOR(decelerate_steps_float);
810 810
 
811 811
     // Steps between acceleration and deceleration, if any
812 812
     plateau_steps -= accelerate_steps + decelerate_steps;

Laden…
Abbrechen
Speichern