Browse Source

Merge pull request #3164 from epatel/epatel/RCBugFix

Fix for #3160 MESH_BED_LEVELING broke correct G1 movement in Z
Scott Lahteine 8 years ago
parent
commit
e8fa843c2d
1 changed files with 8 additions and 2 deletions
  1. 8
    2
      Marlin/Marlin_main.cpp

+ 8
- 2
Marlin/Marlin_main.cpp View File

@@ -6456,11 +6456,12 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
6456 6456
     set_current_to_destination();
6457 6457
     return;
6458 6458
   }
6459
-  float nx, ny, ne, normalized_dist;
6459
+  float nx, ny, nz, ne, normalized_dist;
6460 6460
   if (ix > pix && TEST(x_splits, ix)) {
6461 6461
     nx = mbl.get_x(ix);
6462 6462
     normalized_dist = (nx - current_position[X_AXIS]) / (x - current_position[X_AXIS]);
6463 6463
     ny = current_position[Y_AXIS] + (y - current_position[Y_AXIS]) * normalized_dist;
6464
+    nz = current_position[Z_AXIS] + (z - current_position[Z_AXIS]) * normalized_dist;
6464 6465
     ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
6465 6466
     CBI(x_splits, ix);
6466 6467
   }
@@ -6468,6 +6469,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
6468 6469
     nx = mbl.get_x(pix);
6469 6470
     normalized_dist = (nx - current_position[X_AXIS]) / (x - current_position[X_AXIS]);
6470 6471
     ny = current_position[Y_AXIS] + (y - current_position[Y_AXIS]) * normalized_dist;
6472
+    nz = current_position[Z_AXIS] + (z - current_position[Z_AXIS]) * normalized_dist;
6471 6473
     ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
6472 6474
     CBI(x_splits, pix);
6473 6475
   }
@@ -6475,6 +6477,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
6475 6477
     ny = mbl.get_y(iy);
6476 6478
     normalized_dist = (ny - current_position[Y_AXIS]) / (y - current_position[Y_AXIS]);
6477 6479
     nx = current_position[X_AXIS] + (x - current_position[X_AXIS]) * normalized_dist;
6480
+    nz = current_position[Z_AXIS] + (z - current_position[Z_AXIS]) * normalized_dist;
6478 6481
     ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
6479 6482
     CBI(y_splits, iy);
6480 6483
   }
@@ -6482,6 +6485,7 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
6482 6485
     ny = mbl.get_y(piy);
6483 6486
     normalized_dist = (ny - current_position[Y_AXIS]) / (y - current_position[Y_AXIS]);
6484 6487
     nx = current_position[X_AXIS] + (x - current_position[X_AXIS]) * normalized_dist;
6488
+    nz = current_position[Z_AXIS] + (z - current_position[Z_AXIS]) * normalized_dist;
6485 6489
     ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
6486 6490
     CBI(y_splits, piy);
6487 6491
   }
@@ -6494,10 +6498,12 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
6494 6498
   // Do the split and look for more borders
6495 6499
   destination[X_AXIS] = nx;
6496 6500
   destination[Y_AXIS] = ny;
6501
+  destination[Z_AXIS] = nz;
6497 6502
   destination[E_AXIS] = ne;
6498
-  mesh_plan_buffer_line(nx, ny, z, ne, feed_rate, extruder, x_splits, y_splits);
6503
+  mesh_plan_buffer_line(nx, ny, nz, ne, feed_rate, extruder, x_splits, y_splits);
6499 6504
   destination[X_AXIS] = x;
6500 6505
   destination[Y_AXIS] = y;
6506
+  destination[Z_AXIS] = z;
6501 6507
   destination[E_AXIS] = e;
6502 6508
   mesh_plan_buffer_line(x, y, z, e, feed_rate, extruder, x_splits, y_splits);
6503 6509
 }

Loading…
Cancel
Save