Browse Source

Merge pull request #3781 from AnHardt/minor-delta-segmenting-speedup

Minor DELTA segmentation speedup
Scott Lahteine 8 years ago
parent
commit
552516ddf5
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      Marlin/Marlin_main.cpp

+ 5
- 3
Marlin/Marlin_main.cpp View File

@@ -7372,8 +7372,10 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
7372 7372
     float cartesian_mm = sqrt(sq(difference[X_AXIS]) + sq(difference[Y_AXIS]) + sq(difference[Z_AXIS]));
7373 7373
     if (cartesian_mm < 0.000001) cartesian_mm = abs(difference[E_AXIS]);
7374 7374
     if (cartesian_mm < 0.000001) return false;
7375
-    float seconds = 6000 * cartesian_mm / feedrate / feedrate_multiplier;
7375
+    float _feedrate = feedrate * feedrate_multiplier / 6000.0;
7376
+    float seconds = cartesian_mm / _feedrate;
7376 7377
     int steps = max(1, int(delta_segments_per_second * seconds));
7378
+    float inv_steps = 1.0/steps;
7377 7379
 
7378 7380
     // SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm);
7379 7381
     // SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds);
@@ -7381,7 +7383,7 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
7381 7383
 
7382 7384
     for (int s = 1; s <= steps; s++) {
7383 7385
 
7384
-      float fraction = float(s) / float(steps);
7386
+      float fraction = float(s) * inv_steps;
7385 7387
 
7386 7388
       for (int8_t i = 0; i < NUM_AXIS; i++)
7387 7389
         target[i] = current_position[i] + difference[i] * fraction;
@@ -7395,7 +7397,7 @@ void mesh_buffer_line(float x, float y, float z, const float e, float feed_rate,
7395 7397
       //DEBUG_POS("prepare_move_delta", target);
7396 7398
       //DEBUG_POS("prepare_move_delta", delta);
7397 7399
 
7398
-      planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feedrate / 60 * feedrate_multiplier / 100.0, active_extruder);
7400
+      planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], _feedrate, active_extruder);
7399 7401
     }
7400 7402
     return true;
7401 7403
   }

Loading…
Cancel
Save