|
@@ -44,18 +44,16 @@
|
44
|
44
|
* as possible to determine if this is the case. If this move is within the same cell, we will
|
45
|
45
|
* just do the required Z-Height correction, call the Planner's buffer_line() routine, and leave
|
46
|
46
|
*/
|
47
|
|
- const float start[XYZE] = {
|
48
|
|
- current_position[X_AXIS],
|
49
|
|
- current_position[Y_AXIS],
|
50
|
|
- current_position[Z_AXIS],
|
51
|
|
- current_position[E_AXIS]
|
52
|
|
- },
|
53
|
|
- end[XYZE] = {
|
54
|
|
- destination[X_AXIS],
|
55
|
|
- destination[Y_AXIS],
|
56
|
|
- destination[Z_AXIS],
|
57
|
|
- destination[E_AXIS]
|
58
|
|
- };
|
|
47
|
+ #if ENABLED(SKEW_CORRECTION)
|
|
48
|
+ // For skew correction just adjust the destination point and we're done
|
|
49
|
+ float start[XYZE] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS] },
|
|
50
|
+ end[XYZE] = { destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS] };
|
|
51
|
+ planner.skew(start[X_AXIS], start[Y_AXIS], start[Z_AXIS]);
|
|
52
|
+ planner.skew(end[X_AXIS], end[Y_AXIS], end[Z_AXIS]);
|
|
53
|
+ #else
|
|
54
|
+ const float (&start)[XYZE] = current_position,
|
|
55
|
+ (&end)[XYZE] = destination;
|
|
56
|
+ #endif
|
59
|
57
|
|
60
|
58
|
const int cell_start_xi = get_cell_index_x(start[X_AXIS]),
|
61
|
59
|
cell_start_yi = get_cell_index_y(start[Y_AXIS]),
|
|
@@ -63,13 +61,13 @@
|
63
|
61
|
cell_dest_yi = get_cell_index_y(end[Y_AXIS]);
|
64
|
62
|
|
65
|
63
|
if (g26_debug_flag) {
|
66
|
|
- SERIAL_ECHOPAIR(" ubl.line_to_destination(xe=", end[X_AXIS]);
|
67
|
|
- SERIAL_ECHOPAIR(", ye=", end[Y_AXIS]);
|
68
|
|
- SERIAL_ECHOPAIR(", ze=", end[Z_AXIS]);
|
69
|
|
- SERIAL_ECHOPAIR(", ee=", end[E_AXIS]);
|
|
64
|
+ SERIAL_ECHOPAIR(" ubl.line_to_destination_cartesian(xe=", destination[X_AXIS]);
|
|
65
|
+ SERIAL_ECHOPAIR(", ye=", destination[Y_AXIS]);
|
|
66
|
+ SERIAL_ECHOPAIR(", ze=", destination[Z_AXIS]);
|
|
67
|
+ SERIAL_ECHOPAIR(", ee=", destination[E_AXIS]);
|
70
|
68
|
SERIAL_CHAR(')');
|
71
|
69
|
SERIAL_EOL();
|
72
|
|
- debug_current_and_destination(PSTR("Start of ubl.line_to_destination()"));
|
|
70
|
+ debug_current_and_destination(PSTR("Start of ubl.line_to_destination_cartesian()"));
|
73
|
71
|
}
|
74
|
72
|
|
75
|
73
|
if (cell_start_xi == cell_dest_xi && cell_start_yi == cell_dest_yi) { // if the whole move is within the same cell,
|
|
@@ -89,7 +87,7 @@
|
89
|
87
|
set_current_from_destination();
|
90
|
88
|
|
91
|
89
|
if (g26_debug_flag)
|
92
|
|
- debug_current_and_destination(PSTR("out of bounds in ubl.line_to_destination()"));
|
|
90
|
+ debug_current_and_destination(PSTR("out of bounds in ubl.line_to_destination_cartesian()"));
|
93
|
91
|
|
94
|
92
|
return;
|
95
|
93
|
}
|
|
@@ -132,7 +130,7 @@
|
132
|
130
|
planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + z0, end[E_AXIS], feed_rate, extruder);
|
133
|
131
|
|
134
|
132
|
if (g26_debug_flag)
|
135
|
|
- debug_current_and_destination(PSTR("FINAL_MOVE in ubl.line_to_destination()"));
|
|
133
|
+ debug_current_and_destination(PSTR("FINAL_MOVE in ubl.line_to_destination_cartesian()"));
|
136
|
134
|
|
137
|
135
|
set_current_from_destination();
|
138
|
136
|
return;
|
|
@@ -238,7 +236,7 @@
|
238
|
236
|
}
|
239
|
237
|
|
240
|
238
|
if (g26_debug_flag)
|
241
|
|
- debug_current_and_destination(PSTR("vertical move done in ubl.line_to_destination()"));
|
|
239
|
+ debug_current_and_destination(PSTR("vertical move done in ubl.line_to_destination_cartesian()"));
|
242
|
240
|
|
243
|
241
|
//
|
244
|
242
|
// Check if we are at the final destination. Usually, we won't be, but if it is on a Y Mesh Line, we are done.
|
|
@@ -302,7 +300,7 @@
|
302
|
300
|
}
|
303
|
301
|
|
304
|
302
|
if (g26_debug_flag)
|
305
|
|
- debug_current_and_destination(PSTR("horizontal move done in ubl.line_to_destination()"));
|
|
303
|
+ debug_current_and_destination(PSTR("horizontal move done in ubl.line_to_destination_cartesian()"));
|
306
|
304
|
|
307
|
305
|
if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS])
|
308
|
306
|
goto FINAL_MOVE;
|
|
@@ -396,7 +394,7 @@
|
396
|
394
|
}
|
397
|
395
|
|
398
|
396
|
if (g26_debug_flag)
|
399
|
|
- debug_current_and_destination(PSTR("generic move done in ubl.line_to_destination()"));
|
|
397
|
+ debug_current_and_destination(PSTR("generic move done in ubl.line_to_destination_cartesian()"));
|
400
|
398
|
|
401
|
399
|
if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS])
|
402
|
400
|
goto FINAL_MOVE;
|
|
@@ -460,9 +458,17 @@
|
460
|
458
|
|
461
|
459
|
bool _O2 unified_bed_leveling::prepare_segmented_line_to(const float (&in_target)[XYZE], const float &feedrate) {
|
462
|
460
|
|
463
|
|
- if (!position_is_reachable(rtarget[X_AXIS], rtarget[Y_AXIS])) // fail if moving outside reachable boundary
|
|
461
|
+ if (!position_is_reachable(in_target[X_AXIS], in_target[Y_AXIS])) // fail if moving outside reachable boundary
|
464
|
462
|
return true; // did not move, so current_position still accurate
|
465
|
463
|
|
|
464
|
+ #if ENABLED(SKEW_CORRECTION)
|
|
465
|
+ // For skew correction just adjust the destination point and we're done
|
|
466
|
+ float rtarget[XYZE] = { in_target[X_AXIS], in_target[Y_AXIS], in_target[Z_AXIS], in_target[E_AXIS] };
|
|
467
|
+ planner.skew(rtarget[X_AXIS], rtarget[Y_AXIS], rtarget[Z_AXIS]);
|
|
468
|
+ #else
|
|
469
|
+ const float (&rtarget)[XYZE] = in_target;
|
|
470
|
+ #endif
|
|
471
|
+
|
466
|
472
|
const float total[XYZE] = {
|
467
|
473
|
rtarget[X_AXIS] - current_position[X_AXIS],
|
468
|
474
|
rtarget[Y_AXIS] - current_position[Y_AXIS],
|
|
@@ -507,6 +513,10 @@
|
507
|
513
|
current_position[E_AXIS]
|
508
|
514
|
};
|
509
|
515
|
|
|
516
|
+ #if ENABLED(SKEW_CORRECTION)
|
|
517
|
+ planner.skew(raw[X_AXIS], raw[Y_AXIS], raw[Z_AXIS]);
|
|
518
|
+ #endif
|
|
519
|
+
|
510
|
520
|
// Only compute leveling per segment if ubl active and target below z_fade_height.
|
511
|
521
|
if (!planner.leveling_active || !planner.leveling_active_at_z(rtarget[Z_AXIS])) { // no mesh leveling
|
512
|
522
|
while (--segments) {
|