|
@@ -5331,71 +5331,56 @@ void mesh_plan_buffer_line(float x, float y, float z, const float e, float feed_
|
5331
|
5331
|
piy = MIN(piy, MESH_NUM_Y_POINTS-2);
|
5332
|
5332
|
ix = MIN(ix, MESH_NUM_X_POINTS-2);
|
5333
|
5333
|
iy = MIN(iy, MESH_NUM_Y_POINTS-2);
|
5334
|
|
- if (ix > pix && (x_splits)&(1<<ix)) {
|
5335
|
|
- float nx = mbl.get_x(ix);
|
5336
|
|
- float normalized_dist = (nx - current_position[X_AXIS])/(x - current_position[X_AXIS]);
|
5337
|
|
- float ny = current_position[Y_AXIS] + (y - current_position[Y_AXIS]) * normalized_dist;
|
5338
|
|
- float ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
|
5339
|
|
- x_splits ^= 1 << ix;
|
5340
|
|
- destination[X_AXIS] = nx;
|
5341
|
|
- destination[Y_AXIS] = ny;
|
5342
|
|
- destination[E_AXIS] = ne;
|
5343
|
|
- mesh_plan_buffer_line(nx, ny, z, ne, feed_rate, extruder, x_splits, y_splits);
|
5344
|
|
- destination[X_AXIS] = x;
|
5345
|
|
- destination[Y_AXIS] = y;
|
5346
|
|
- destination[E_AXIS] = e;
|
5347
|
|
- mesh_plan_buffer_line(x, y, z, e, feed_rate, extruder, x_splits, y_splits);
|
5348
|
|
- return;
|
5349
|
|
- } else if (ix < pix && (x_splits)&(1<<pix)) {
|
5350
|
|
- float nx = mbl.get_x(pix);
|
5351
|
|
- float normalized_dist = (nx - current_position[X_AXIS])/(x - current_position[X_AXIS]);
|
5352
|
|
- float ny = current_position[Y_AXIS] + (y - current_position[Y_AXIS]) * normalized_dist;
|
5353
|
|
- float ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
|
5354
|
|
- x_splits ^= 1 << pix;
|
5355
|
|
- destination[X_AXIS] = nx;
|
5356
|
|
- destination[Y_AXIS] = ny;
|
5357
|
|
- destination[E_AXIS] = ne;
|
5358
|
|
- mesh_plan_buffer_line(nx, ny, z, ne, feed_rate, extruder, x_splits, y_splits);
|
5359
|
|
- destination[X_AXIS] = x;
|
5360
|
|
- destination[Y_AXIS] = y;
|
5361
|
|
- destination[E_AXIS] = e;
|
5362
|
|
- mesh_plan_buffer_line(x, y, z, e, feed_rate, extruder, x_splits, y_splits);
|
5363
|
|
- return;
|
5364
|
|
- } else if (iy > piy && (y_splits)&(1<<iy)) {
|
5365
|
|
- float ny = mbl.get_y(iy);
|
5366
|
|
- float normalized_dist = (ny - current_position[Y_AXIS])/(y - current_position[Y_AXIS]);
|
5367
|
|
- float nx = current_position[X_AXIS] + (x - current_position[X_AXIS]) * normalized_dist;
|
5368
|
|
- float ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
|
5369
|
|
- y_splits ^= 1 << iy;
|
5370
|
|
- destination[X_AXIS] = nx;
|
5371
|
|
- destination[Y_AXIS] = ny;
|
5372
|
|
- destination[E_AXIS] = ne;
|
5373
|
|
- mesh_plan_buffer_line(nx, ny, z, ne, feed_rate, extruder, x_splits, y_splits);
|
5374
|
|
- destination[X_AXIS] = x;
|
5375
|
|
- destination[Y_AXIS] = y;
|
5376
|
|
- destination[E_AXIS] = e;
|
5377
|
|
- mesh_plan_buffer_line(x, y, z, e, feed_rate, extruder, x_splits, y_splits);
|
5378
|
|
- return;
|
5379
|
|
- } else if (iy < piy && (y_splits)&(1<<piy)) {
|
5380
|
|
- float ny = mbl.get_y(piy);
|
5381
|
|
- float normalized_dist = (ny - current_position[Y_AXIS])/(y - current_position[Y_AXIS]);
|
5382
|
|
- float nx = current_position[X_AXIS] + (x - current_position[X_AXIS]) * normalized_dist;
|
5383
|
|
- float ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
|
5384
|
|
- y_splits ^= 1 << piy;
|
5385
|
|
- destination[X_AXIS] = nx;
|
5386
|
|
- destination[Y_AXIS] = ny;
|
5387
|
|
- destination[E_AXIS] = ne;
|
5388
|
|
- mesh_plan_buffer_line(nx, ny, z, ne, feed_rate, extruder, x_splits, y_splits);
|
5389
|
|
- destination[X_AXIS] = x;
|
5390
|
|
- destination[Y_AXIS] = y;
|
5391
|
|
- destination[E_AXIS] = e;
|
5392
|
|
- mesh_plan_buffer_line(x, y, z, e, feed_rate, extruder, x_splits, y_splits);
|
|
5334
|
+ if (pix == ix && piy == iy) {
|
|
5335
|
+ // Start and end on same mesh square
|
|
5336
|
+ plan_buffer_line(x, y, z, e, feed_rate, extruder);
|
|
5337
|
+ for(int8_t i=0; i < NUM_AXIS; i++) {
|
|
5338
|
+ current_position[i] = destination[i];
|
|
5339
|
+ }
|
5393
|
5340
|
return;
|
5394
|
5341
|
}
|
5395
|
|
- plan_buffer_line(x, y, z, e, feed_rate, extruder);
|
5396
|
|
- for(int8_t i=0; i < NUM_AXIS; i++) {
|
5397
|
|
- current_position[i] = destination[i];
|
|
5342
|
+ float nx, ny, ne, normalized_dist;
|
|
5343
|
+ if (ix > pix && (x_splits) & BIT(ix)) {
|
|
5344
|
+ nx = mbl.get_x(ix);
|
|
5345
|
+ normalized_dist = (nx - current_position[X_AXIS])/(x - current_position[X_AXIS]);
|
|
5346
|
+ ny = current_position[Y_AXIS] + (y - current_position[Y_AXIS]) * normalized_dist;
|
|
5347
|
+ ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
|
|
5348
|
+ x_splits ^= BIT(ix);
|
|
5349
|
+ } else if (ix < pix && (x_splits) & BIT(pix)) {
|
|
5350
|
+ nx = mbl.get_x(pix);
|
|
5351
|
+ normalized_dist = (nx - current_position[X_AXIS])/(x - current_position[X_AXIS]);
|
|
5352
|
+ ny = current_position[Y_AXIS] + (y - current_position[Y_AXIS]) * normalized_dist;
|
|
5353
|
+ ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
|
|
5354
|
+ x_splits ^= BIT(pix);
|
|
5355
|
+ } else if (iy > piy && (y_splits) & BIT(iy)) {
|
|
5356
|
+ ny = mbl.get_y(iy);
|
|
5357
|
+ normalized_dist = (ny - current_position[Y_AXIS])/(y - current_position[Y_AXIS]);
|
|
5358
|
+ nx = current_position[X_AXIS] + (x - current_position[X_AXIS]) * normalized_dist;
|
|
5359
|
+ ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
|
|
5360
|
+ y_splits ^= BIT(iy);
|
|
5361
|
+ } else if (iy < piy && (y_splits) & BIT(piy)) {
|
|
5362
|
+ ny = mbl.get_y(piy);
|
|
5363
|
+ normalized_dist = (ny - current_position[Y_AXIS])/(y - current_position[Y_AXIS]);
|
|
5364
|
+ nx = current_position[X_AXIS] + (x - current_position[X_AXIS]) * normalized_dist;
|
|
5365
|
+ ne = current_position[E_AXIS] + (e - current_position[E_AXIS]) * normalized_dist;
|
|
5366
|
+ y_splits ^= BIT(piy);
|
|
5367
|
+ } else {
|
|
5368
|
+ // Already split on a border
|
|
5369
|
+ plan_buffer_line(x, y, z, e, feed_rate, extruder);
|
|
5370
|
+ for(int8_t i=0; i < NUM_AXIS; i++) {
|
|
5371
|
+ current_position[i] = destination[i];
|
|
5372
|
+ }
|
|
5373
|
+ return;
|
5398
|
5374
|
}
|
|
5375
|
+ // Do the split and look for more borders
|
|
5376
|
+ destination[X_AXIS] = nx;
|
|
5377
|
+ destination[Y_AXIS] = ny;
|
|
5378
|
+ destination[E_AXIS] = ne;
|
|
5379
|
+ mesh_plan_buffer_line(nx, ny, z, ne, feed_rate, extruder, x_splits, y_splits);
|
|
5380
|
+ destination[X_AXIS] = x;
|
|
5381
|
+ destination[Y_AXIS] = y;
|
|
5382
|
+ destination[E_AXIS] = e;
|
|
5383
|
+ mesh_plan_buffer_line(x, y, z, e, feed_rate, extruder, x_splits, y_splits);
|
5399
|
5384
|
}
|
5400
|
5385
|
#endif // MESH_BED_LEVELING
|
5401
|
5386
|
|