Переглянути джерело

Lightly optimize arc length calculation

Scott Lahteine 6 роки тому
джерело
коміт
9644fe1839

+ 2
- 1
Marlin/src/gcode/motion/G2_G3.cpp Переглянути файл

86
   if (angular_travel == 0 && current_position[p_axis] == cart[p_axis] && current_position[q_axis] == cart[q_axis])
86
   if (angular_travel == 0 && current_position[p_axis] == cart[p_axis] && current_position[q_axis] == cart[q_axis])
87
     angular_travel = RADIANS(360);
87
     angular_travel = RADIANS(360);
88
 
88
 
89
-  const float mm_of_travel = HYPOT(angular_travel * radius, FABS(linear_travel));
89
+  const float flat_mm = radius * angular_travel,
90
+              mm_of_travel = linear_travel ? HYPOT(flat_mm, linear_travel) : flat_mm;
90
   if (mm_of_travel < 0.001) return;
91
   if (mm_of_travel < 0.001) return;
91
 
92
 
92
   uint16_t segments = FLOOR(mm_of_travel / (MM_PER_ARC_SEGMENT));
93
   uint16_t segments = FLOOR(mm_of_travel / (MM_PER_ARC_SEGMENT));

+ 1
- 2
Marlin/src/module/planner.cpp Переглянути файл

373
   }
373
   }
374
 }
374
 }
375
 
375
 
376
-/*
376
+/**
377
  * Recalculate the motion plan according to the following algorithm:
377
  * Recalculate the motion plan according to the following algorithm:
378
  *
378
  *
379
  *   1. Go over every block in reverse order...
379
  *   1. Go over every block in reverse order...
403
   recalculate_trapezoids();
403
   recalculate_trapezoids();
404
 }
404
 }
405
 
405
 
406
-
407
 #if ENABLED(AUTOTEMP)
406
 #if ENABLED(AUTOTEMP)
408
 
407
 
409
   void Planner::getHighESpeed() {
408
   void Planner::getHighESpeed() {

Завантаження…
Відмінити
Зберегти