|
@@ -31,7 +31,14 @@
|
31
|
31
|
|
32
|
32
|
extern float destination[XYZE];
|
33
|
33
|
extern void set_current_to_destination();
|
34
|
|
- extern float destination[];
|
|
34
|
+
|
|
35
|
+ static void debug_echo_axis(const AxisEnum axis) {
|
|
36
|
+ if (current_position[axis] == destination[axis])
|
|
37
|
+ SERIAL_ECHOPGM("-------------");
|
|
38
|
+ else
|
|
39
|
+ SERIAL_ECHO_F(destination[X_AXIS], 6);
|
|
40
|
+ }
|
|
41
|
+
|
35
|
42
|
void debug_current_and_destination(char *title) {
|
36
|
43
|
|
37
|
44
|
// if the title message starts with a '!' it is so important, we are going to
|
|
@@ -67,32 +74,13 @@
|
67
|
74
|
SERIAL_ECHOPGM(", ");
|
68
|
75
|
SERIAL_ECHO_F(current_position[E_AXIS], 6);
|
69
|
76
|
SERIAL_ECHOPGM(" ) destination=( ");
|
70
|
|
- if (current_position[X_AXIS] == destination[X_AXIS])
|
71
|
|
- SERIAL_ECHOPGM("-------------");
|
72
|
|
- else
|
73
|
|
- SERIAL_ECHO_F(destination[X_AXIS], 6);
|
74
|
|
-
|
|
77
|
+ debug_echo_axis(X_AXIS);
|
75
|
78
|
SERIAL_ECHOPGM(", ");
|
76
|
|
-
|
77
|
|
- if (current_position[Y_AXIS] == destination[Y_AXIS])
|
78
|
|
- SERIAL_ECHOPGM("-------------");
|
79
|
|
- else
|
80
|
|
- SERIAL_ECHO_F(destination[Y_AXIS], 6);
|
81
|
|
-
|
|
79
|
+ debug_echo_axis(Y_AXIS);
|
82
|
80
|
SERIAL_ECHOPGM(", ");
|
83
|
|
-
|
84
|
|
- if (current_position[Z_AXIS] == destination[Z_AXIS])
|
85
|
|
- SERIAL_ECHOPGM("-------------");
|
86
|
|
- else
|
87
|
|
- SERIAL_ECHO_F(destination[Z_AXIS], 6);
|
88
|
|
-
|
|
81
|
+ debug_echo_axis(Z_AXIS);
|
89
|
82
|
SERIAL_ECHOPGM(", ");
|
90
|
|
-
|
91
|
|
- if (current_position[E_AXIS] == destination[E_AXIS])
|
92
|
|
- SERIAL_ECHOPGM("-------------");
|
93
|
|
- else
|
94
|
|
- SERIAL_ECHO_F(destination[E_AXIS], 6);
|
95
|
|
-
|
|
83
|
+ debug_echo_axis(E_AXIS);
|
96
|
84
|
SERIAL_ECHOPGM(" ) ");
|
97
|
85
|
SERIAL_ECHO(title);
|
98
|
86
|
SERIAL_EOL;
|
|
@@ -105,32 +93,37 @@
|
105
|
93
|
//}
|
106
|
94
|
}
|
107
|
95
|
|
108
|
|
- void ubl_line_to_destination(const float &x_end, const float &y_end, const float &z_end, const float &e_end, const float &feed_rate, uint8_t extruder) {
|
|
96
|
+ void ubl_line_to_destination(const float &feed_rate, uint8_t extruder) {
|
109
|
97
|
/**
|
110
|
98
|
* Much of the nozzle movement will be within the same cell. So we will do as little computation
|
111
|
99
|
* as possible to determine if this is the case. If this move is within the same cell, we will
|
112
|
100
|
* just do the required Z-Height correction, call the Planner's buffer_line() routine, and leave
|
113
|
101
|
*/
|
114
|
|
- const float x_start = current_position[X_AXIS],
|
115
|
|
- y_start = current_position[Y_AXIS],
|
116
|
|
- z_start = current_position[Z_AXIS],
|
117
|
|
- e_start = current_position[E_AXIS];
|
118
|
|
-
|
119
|
|
- const int cell_start_xi = ubl.get_cell_index_x(RAW_X_POSITION(x_start)),
|
120
|
|
- cell_start_yi = ubl.get_cell_index_y(RAW_Y_POSITION(y_start)),
|
121
|
|
- cell_dest_xi = ubl.get_cell_index_x(RAW_X_POSITION(x_end)),
|
122
|
|
- cell_dest_yi = ubl.get_cell_index_y(RAW_Y_POSITION(y_end));
|
|
102
|
+ const float start[XYZE] = {
|
|
103
|
+ current_position[X_AXIS],
|
|
104
|
+ current_position[Y_AXIS],
|
|
105
|
+ current_position[Z_AXIS],
|
|
106
|
+ current_position[E_AXIS]
|
|
107
|
+ },
|
|
108
|
+ end[XYZE] = {
|
|
109
|
+ destination[X_AXIS],
|
|
110
|
+ destination[Y_AXIS],
|
|
111
|
+ destination[Z_AXIS],
|
|
112
|
+ destination[E_AXIS]
|
|
113
|
+ };
|
|
114
|
+
|
|
115
|
+ const int cell_start_xi = ubl.get_cell_index_x(RAW_X_POSITION(start[X_AXIS])),
|
|
116
|
+ cell_start_yi = ubl.get_cell_index_y(RAW_Y_POSITION(start[Y_AXIS])),
|
|
117
|
+ cell_dest_xi = ubl.get_cell_index_x(RAW_X_POSITION(end[X_AXIS])),
|
|
118
|
+ cell_dest_yi = ubl.get_cell_index_y(RAW_Y_POSITION(end[Y_AXIS]));
|
123
|
119
|
|
124
|
120
|
if (ubl.g26_debug_flag) {
|
125
|
|
- SERIAL_ECHOPGM(" ubl_line_to_destination(xe=");
|
126
|
|
- SERIAL_ECHO(x_end);
|
127
|
|
- SERIAL_ECHOPGM(", ye=");
|
128
|
|
- SERIAL_ECHO(y_end);
|
129
|
|
- SERIAL_ECHOPGM(", ze=");
|
130
|
|
- SERIAL_ECHO(z_end);
|
131
|
|
- SERIAL_ECHOPGM(", ee=");
|
132
|
|
- SERIAL_ECHO(e_end);
|
133
|
|
- SERIAL_ECHOLNPGM(")");
|
|
121
|
+ SERIAL_ECHOPAIR(" ubl_line_to_destination(xe=", end[X_AXIS]);
|
|
122
|
+ SERIAL_ECHOPAIR(", ye=", end[Y_AXIS]);
|
|
123
|
+ SERIAL_ECHOPAIR(", ze=", end[Z_AXIS]);
|
|
124
|
+ SERIAL_ECHOPAIR(", ee=", end[E_AXIS]);
|
|
125
|
+ SERIAL_CHAR(')');
|
|
126
|
+ SERIAL_EOL;
|
134
|
127
|
debug_current_and_destination((char*)"Start of ubl_line_to_destination()");
|
135
|
128
|
}
|
136
|
129
|
|
|
@@ -142,12 +135,12 @@
|
142
|
135
|
* But we detect it and isolate it. For now, we just pass along the request.
|
143
|
136
|
*/
|
144
|
137
|
|
145
|
|
- if (cell_dest_xi < 0 || cell_dest_yi < 0 || cell_dest_xi >= UBL_MESH_NUM_X_POINTS || cell_dest_yi >= UBL_MESH_NUM_Y_POINTS) {
|
|
138
|
+ if (!WITHIN(cell_dest_xi, 0, UBL_MESH_NUM_X_POINTS - 1) || !WITHIN(cell_dest_yi, 0, UBL_MESH_NUM_Y_POINTS - 1)) {
|
146
|
139
|
|
147
|
140
|
// Note: There is no Z Correction in this case. We are off the grid and don't know what
|
148
|
141
|
// a reasonable correction would be.
|
149
|
142
|
|
150
|
|
- planner.buffer_line(x_end, y_end, z_end + ubl.state.z_offset, e_end, feed_rate, extruder);
|
|
143
|
+ planner.buffer_line(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + ubl.state.z_offset, end[E_AXIS], feed_rate, extruder);
|
151
|
144
|
set_current_to_destination();
|
152
|
145
|
|
153
|
146
|
if (ubl.g26_debug_flag)
|
|
@@ -167,7 +160,7 @@
|
167
|
160
|
* to create a 1-over number for us. That will allow us to do a floating point multiply instead of a floating point divide.
|
168
|
161
|
*/
|
169
|
162
|
|
170
|
|
- const float xratio = (RAW_X_POSITION(x_end) - ubl.mesh_index_to_xpos[cell_dest_xi]) * (1.0 / (MESH_X_DIST)),
|
|
163
|
+ const float xratio = (RAW_X_POSITION(end[X_AXIS]) - ubl.mesh_index_to_xpos[cell_dest_xi]) * (1.0 / (MESH_X_DIST)),
|
171
|
164
|
z1 = ubl.z_values[cell_dest_xi ][cell_dest_yi ] + xratio *
|
172
|
165
|
(ubl.z_values[cell_dest_xi + 1][cell_dest_yi ] - ubl.z_values[cell_dest_xi][cell_dest_yi ]),
|
173
|
166
|
z2 = ubl.z_values[cell_dest_xi ][cell_dest_yi + 1] + xratio *
|
|
@@ -176,7 +169,7 @@
|
176
|
169
|
// we are done with the fractional X distance into the cell. Now with the two Z-Heights we have calculated, we
|
177
|
170
|
// are going to apply the Y-Distance into the cell to interpolate the final Z correction.
|
178
|
171
|
|
179
|
|
- const float yratio = (RAW_Y_POSITION(y_end) - ubl.mesh_index_to_ypos[cell_dest_yi]) * (1.0 / (MESH_Y_DIST));
|
|
172
|
+ const float yratio = (RAW_Y_POSITION(end[Y_AXIS]) - ubl.mesh_index_to_ypos[cell_dest_yi]) * (1.0 / (MESH_Y_DIST));
|
180
|
173
|
|
181
|
174
|
float z0 = z1 + (z2 - z1) * yratio;
|
182
|
175
|
|
|
@@ -186,20 +179,20 @@
|
186
|
179
|
*/
|
187
|
180
|
/*
|
188
|
181
|
z_optimized = z0;
|
189
|
|
- z0 = ubl.get_z_correction(x_end, y_end);
|
|
182
|
+ z0 = ubl.get_z_correction(end[X_AXIS], end[Y_AXIS]);
|
190
|
183
|
if (fabs(z_optimized - z0) > .01 || isnan(z0) || isnan(z_optimized)) {
|
191
|
184
|
debug_current_and_destination((char*)"FINAL_MOVE: z_correction()");
|
192
|
185
|
if (isnan(z0)) SERIAL_ECHO(" z0==NAN ");
|
193
|
186
|
if (isnan(z_optimized)) SERIAL_ECHO(" z_optimized==NAN ");
|
194
|
|
- SERIAL_ECHOPAIR(" x_end=", x_end);
|
195
|
|
- SERIAL_ECHOPAIR(" y_end=", y_end);
|
|
187
|
+ SERIAL_ECHOPAIR(" end[X_AXIS]=", end[X_AXIS]);
|
|
188
|
+ SERIAL_ECHOPAIR(" end[Y_AXIS]=", end[Y_AXIS]);
|
196
|
189
|
SERIAL_ECHOPAIR(" z0=", z0);
|
197
|
190
|
SERIAL_ECHOPAIR(" z_optimized=", z_optimized);
|
198
|
191
|
SERIAL_ECHOPAIR(" err=",fabs(z_optimized - z0));
|
199
|
192
|
SERIAL_EOL;
|
200
|
193
|
}
|
201
|
194
|
//*/
|
202
|
|
- z0 *= ubl.fade_scaling_factor_for_z(z_end);
|
|
195
|
+ z0 *= ubl.fade_scaling_factor_for_z(end[Z_AXIS]);
|
203
|
196
|
|
204
|
197
|
/**
|
205
|
198
|
* If part of the Mesh is undefined, it will show up as NAN
|
|
@@ -210,7 +203,7 @@
|
210
|
203
|
*/
|
211
|
204
|
if (isnan(z0)) z0 = 0.0;
|
212
|
205
|
|
213
|
|
- planner.buffer_line(x_end, y_end, z_end + z0 + ubl.state.z_offset, e_end, feed_rate, extruder);
|
|
206
|
+ planner.buffer_line(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + z0 + ubl.state.z_offset, end[E_AXIS], feed_rate, extruder);
|
214
|
207
|
|
215
|
208
|
if (ubl.g26_debug_flag)
|
216
|
209
|
debug_current_and_destination((char*)"FINAL_MOVE in ubl_line_to_destination()");
|
|
@@ -227,8 +220,8 @@
|
227
|
220
|
* blocks of code:
|
228
|
221
|
*/
|
229
|
222
|
|
230
|
|
- const float dx = x_end - x_start,
|
231
|
|
- dy = y_end - y_start;
|
|
223
|
+ const float dx = end[X_AXIS] - start[X_AXIS],
|
|
224
|
+ dy = end[Y_AXIS] - start[Y_AXIS];
|
232
|
225
|
|
233
|
226
|
const int left_flag = dx < 0.0 ? 1 : 0,
|
234
|
227
|
down_flag = dy < 0.0 ? 1 : 0;
|
|
@@ -251,8 +244,8 @@
|
251
|
244
|
const bool use_x_dist = adx > ady;
|
252
|
245
|
|
253
|
246
|
float on_axis_distance = use_x_dist ? dx : dy,
|
254
|
|
- e_position = e_end - e_start,
|
255
|
|
- z_position = z_end - z_start;
|
|
247
|
+ e_position = end[E_AXIS] - start[E_AXIS],
|
|
248
|
+ z_position = end[Z_AXIS] - start[Z_AXIS];
|
256
|
249
|
|
257
|
250
|
const float e_normalized_dist = e_position / on_axis_distance,
|
258
|
251
|
z_normalized_dist = z_position / on_axis_distance;
|
|
@@ -260,7 +253,7 @@
|
260
|
253
|
int current_xi = cell_start_xi, current_yi = cell_start_yi;
|
261
|
254
|
|
262
|
255
|
const float m = dy / dx,
|
263
|
|
- c = y_start - m * x_start;
|
|
256
|
+ c = start[Y_AXIS] - m * start[X_AXIS];
|
264
|
257
|
|
265
|
258
|
const bool inf_normalized_flag = NEAR_ZERO(on_axis_distance),
|
266
|
259
|
inf_m_flag = NEAR_ZERO(dx);
|
|
@@ -281,9 +274,9 @@
|
281
|
274
|
* else, we know the next X is the same so we can recover and continue!
|
282
|
275
|
* Calculate X at the next Y mesh line
|
283
|
276
|
*/
|
284
|
|
- const float x = inf_m_flag ? x_start : (next_mesh_line_y - c) / m;
|
|
277
|
+ const float x = inf_m_flag ? start[X_AXIS] : (next_mesh_line_y - c) / m;
|
285
|
278
|
|
286
|
|
- float z0 = ubl.get_z_correction_along_horizontal_mesh_line_at_specific_X(x, current_xi, current_yi);
|
|
279
|
+ float z0 = ubl.z_correction_for_x_on_horizontal_mesh_line(x, current_xi, current_yi);
|
287
|
280
|
|
288
|
281
|
/**
|
289
|
282
|
* Debug code to use non-optimized get_z_correction() and to do a sanity check
|
|
@@ -305,7 +298,7 @@
|
305
|
298
|
}
|
306
|
299
|
//*/
|
307
|
300
|
|
308
|
|
- z0 *= ubl.fade_scaling_factor_for_z(z_end);
|
|
301
|
+ z0 *= ubl.fade_scaling_factor_for_z(end[Z_AXIS]);
|
309
|
302
|
|
310
|
303
|
/**
|
311
|
304
|
* If part of the Mesh is undefined, it will show up as NAN
|
|
@@ -324,15 +317,15 @@
|
324
|
317
|
* happens, it might be best to remove the check and always 'schedule' the move because
|
325
|
318
|
* the planner.buffer_line() routine will filter it if that happens.
|
326
|
319
|
*/
|
327
|
|
- if (y != y_start) {
|
|
320
|
+ if (y != start[Y_AXIS]) {
|
328
|
321
|
if (!inf_normalized_flag) {
|
329
|
|
- on_axis_distance = y - y_start; // we don't need to check if the extruder position
|
330
|
|
- e_position = e_start + on_axis_distance * e_normalized_dist; // is based on X or Y because this is a vertical move
|
331
|
|
- z_position = z_start + on_axis_distance * z_normalized_dist;
|
|
322
|
+ on_axis_distance = y - start[Y_AXIS]; // we don't need to check if the extruder position
|
|
323
|
+ e_position = start[E_AXIS] + on_axis_distance * e_normalized_dist; // is based on X or Y because this is a vertical move
|
|
324
|
+ z_position = start[Z_AXIS] + on_axis_distance * z_normalized_dist;
|
332
|
325
|
}
|
333
|
326
|
else {
|
334
|
|
- e_position = e_start;
|
335
|
|
- z_position = z_start;
|
|
327
|
+ e_position = start[E_AXIS];
|
|
328
|
+ z_position = start[Z_AXIS];
|
336
|
329
|
}
|
337
|
330
|
|
338
|
331
|
planner.buffer_line(x, y, z_position + z0 + ubl.state.z_offset, e_position, feed_rate, extruder);
|
|
@@ -345,7 +338,7 @@
|
345
|
338
|
//
|
346
|
339
|
// 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.
|
347
|
340
|
//
|
348
|
|
- if (current_position[X_AXIS] != x_end || current_position[Y_AXIS] != y_end)
|
|
341
|
+ if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS])
|
349
|
342
|
goto FINAL_MOVE;
|
350
|
343
|
|
351
|
344
|
set_current_to_destination();
|
|
@@ -368,7 +361,7 @@
|
368
|
361
|
const float next_mesh_line_x = LOGICAL_X_POSITION(ubl.mesh_index_to_xpos[current_xi]),
|
369
|
362
|
y = m * next_mesh_line_x + c; // Calculate X at the next Y mesh line
|
370
|
363
|
|
371
|
|
- float z0 = ubl.get_z_correction_along_vertical_mesh_line_at_specific_Y(y, current_xi, current_yi);
|
|
364
|
+ float z0 = ubl.z_correction_for_y_on_vertical_mesh_line(y, current_xi, current_yi);
|
372
|
365
|
|
373
|
366
|
/**
|
374
|
367
|
* Debug code to use non-optimized get_z_correction() and to do a sanity check
|
|
@@ -390,7 +383,7 @@
|
390
|
383
|
}
|
391
|
384
|
//*/
|
392
|
385
|
|
393
|
|
- z0 = z0 * ubl.fade_scaling_factor_for_z(z_end);
|
|
386
|
+ z0 *= ubl.fade_scaling_factor_for_z(end[Z_AXIS]);
|
394
|
387
|
|
395
|
388
|
/**
|
396
|
389
|
* If part of the Mesh is undefined, it will show up as NAN
|
|
@@ -409,15 +402,15 @@
|
409
|
402
|
* that happens, it might be best to remove the check and always 'schedule' the move because
|
410
|
403
|
* the planner.buffer_line() routine will filter it if that happens.
|
411
|
404
|
*/
|
412
|
|
- if (x != x_start) {
|
|
405
|
+ if (x != start[X_AXIS]) {
|
413
|
406
|
if (!inf_normalized_flag) {
|
414
|
|
- on_axis_distance = x - x_start; // we don't need to check if the extruder position
|
415
|
|
- e_position = e_start + on_axis_distance * e_normalized_dist; // is based on X or Y because this is a horizontal move
|
416
|
|
- z_position = z_start + on_axis_distance * z_normalized_dist;
|
|
407
|
+ on_axis_distance = x - start[X_AXIS]; // we don't need to check if the extruder position
|
|
408
|
+ e_position = start[E_AXIS] + on_axis_distance * e_normalized_dist; // is based on X or Y because this is a horizontal move
|
|
409
|
+ z_position = start[Z_AXIS] + on_axis_distance * z_normalized_dist;
|
417
|
410
|
}
|
418
|
411
|
else {
|
419
|
|
- e_position = e_start;
|
420
|
|
- z_position = z_start;
|
|
412
|
+ e_position = start[E_AXIS];
|
|
413
|
+ z_position = start[Z_AXIS];
|
421
|
414
|
}
|
422
|
415
|
|
423
|
416
|
planner.buffer_line(x, y, z_position + z0 + ubl.state.z_offset, e_position, feed_rate, extruder);
|
|
@@ -427,7 +420,7 @@
|
427
|
420
|
if (ubl.g26_debug_flag)
|
428
|
421
|
debug_current_and_destination((char*)"horizontal move done in ubl_line_to_destination()");
|
429
|
422
|
|
430
|
|
- if (current_position[X_AXIS] != x_end || current_position[Y_AXIS] != y_end)
|
|
423
|
+ if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS])
|
431
|
424
|
goto FINAL_MOVE;
|
432
|
425
|
|
433
|
426
|
set_current_to_destination();
|
|
@@ -454,16 +447,16 @@
|
454
|
447
|
const float next_mesh_line_x = LOGICAL_X_POSITION(ubl.mesh_index_to_xpos[current_xi + dxi]),
|
455
|
448
|
next_mesh_line_y = LOGICAL_Y_POSITION(ubl.mesh_index_to_ypos[current_yi + dyi]),
|
456
|
449
|
y = m * next_mesh_line_x + c, // Calculate Y at the next X mesh line
|
457
|
|
- x = (next_mesh_line_y - c) / m; // Calculate X at the next Y mesh line (we don't have to worry
|
458
|
|
- // about m being equal to 0.0 If this was the case, we would have
|
459
|
|
- // detected this as a vertical line move up above and we wouldn't
|
460
|
|
- // be down here doing a generic type of move.
|
|
450
|
+ x = (next_mesh_line_y - c) / m; // Calculate X at the next Y mesh line
|
|
451
|
+ // (No need to worry about m being zero.
|
|
452
|
+ // If that was the case, it was already detected
|
|
453
|
+ // as a vertical line move above.)
|
461
|
454
|
|
462
|
455
|
if (left_flag == (x > next_mesh_line_x)) { // Check if we hit the Y line first
|
463
|
456
|
//
|
464
|
457
|
// Yes! Crossing a Y Mesh Line next
|
465
|
458
|
//
|
466
|
|
- float z0 = ubl.get_z_correction_along_horizontal_mesh_line_at_specific_X(x, current_xi - left_flag, current_yi + dyi);
|
|
459
|
+ float z0 = ubl.z_correction_for_x_on_horizontal_mesh_line(x, current_xi - left_flag, current_yi + dyi);
|
467
|
460
|
|
468
|
461
|
/**
|
469
|
462
|
* Debug code to use non-optimized get_z_correction() and to do a sanity check
|
|
@@ -486,7 +479,7 @@
|
486
|
479
|
}
|
487
|
480
|
//*/
|
488
|
481
|
|
489
|
|
- z0 *= ubl.fade_scaling_factor_for_z(z_end);
|
|
482
|
+ z0 *= ubl.fade_scaling_factor_for_z(end[Z_AXIS]);
|
490
|
483
|
|
491
|
484
|
/**
|
492
|
485
|
* If part of the Mesh is undefined, it will show up as NAN
|
|
@@ -498,13 +491,13 @@
|
498
|
491
|
if (isnan(z0)) z0 = 0.0;
|
499
|
492
|
|
500
|
493
|
if (!inf_normalized_flag) {
|
501
|
|
- on_axis_distance = use_x_dist ? x - x_start : next_mesh_line_y - y_start;
|
502
|
|
- e_position = e_start + on_axis_distance * e_normalized_dist;
|
503
|
|
- z_position = z_start + on_axis_distance * z_normalized_dist;
|
|
494
|
+ on_axis_distance = use_x_dist ? x - start[X_AXIS] : next_mesh_line_y - start[Y_AXIS];
|
|
495
|
+ e_position = start[E_AXIS] + on_axis_distance * e_normalized_dist;
|
|
496
|
+ z_position = start[Z_AXIS] + on_axis_distance * z_normalized_dist;
|
504
|
497
|
}
|
505
|
498
|
else {
|
506
|
|
- e_position = e_start;
|
507
|
|
- z_position = z_start;
|
|
499
|
+ e_position = start[E_AXIS];
|
|
500
|
+ z_position = start[Z_AXIS];
|
508
|
501
|
}
|
509
|
502
|
planner.buffer_line(x, next_mesh_line_y, z_position + z0 + ubl.state.z_offset, e_position, feed_rate, extruder);
|
510
|
503
|
current_yi += dyi;
|
|
@@ -514,7 +507,7 @@
|
514
|
507
|
//
|
515
|
508
|
// Yes! Crossing a X Mesh Line next
|
516
|
509
|
//
|
517
|
|
- float z0 = ubl.get_z_correction_along_vertical_mesh_line_at_specific_Y(y, current_xi + dxi, current_yi - down_flag);
|
|
510
|
+ float z0 = ubl.z_correction_for_y_on_vertical_mesh_line(y, current_xi + dxi, current_yi - down_flag);
|
518
|
511
|
|
519
|
512
|
/**
|
520
|
513
|
* Debug code to use non-optimized get_z_correction() and to do a sanity check
|
|
@@ -536,7 +529,7 @@
|
536
|
529
|
}
|
537
|
530
|
//*/
|
538
|
531
|
|
539
|
|
- z0 *= ubl.fade_scaling_factor_for_z(z_end);
|
|
532
|
+ z0 *= ubl.fade_scaling_factor_for_z(end[Z_AXIS]);
|
540
|
533
|
|
541
|
534
|
/**
|
542
|
535
|
* If part of the Mesh is undefined, it will show up as NAN
|
|
@@ -548,13 +541,13 @@
|
548
|
541
|
if (isnan(z0)) z0 = 0.0;
|
549
|
542
|
|
550
|
543
|
if (!inf_normalized_flag) {
|
551
|
|
- on_axis_distance = use_x_dist ? next_mesh_line_x - x_start : y - y_start;
|
552
|
|
- e_position = e_start + on_axis_distance * e_normalized_dist;
|
553
|
|
- z_position = z_start + on_axis_distance * z_normalized_dist;
|
|
544
|
+ on_axis_distance = use_x_dist ? next_mesh_line_x - start[X_AXIS] : y - start[Y_AXIS];
|
|
545
|
+ e_position = start[E_AXIS] + on_axis_distance * e_normalized_dist;
|
|
546
|
+ z_position = start[Z_AXIS] + on_axis_distance * z_normalized_dist;
|
554
|
547
|
}
|
555
|
548
|
else {
|
556
|
|
- e_position = e_start;
|
557
|
|
- z_position = z_start;
|
|
549
|
+ e_position = start[E_AXIS];
|
|
550
|
+ z_position = start[Z_AXIS];
|
558
|
551
|
}
|
559
|
552
|
|
560
|
553
|
planner.buffer_line(next_mesh_line_x, y, z_position + z0 + ubl.state.z_offset, e_position, feed_rate, extruder);
|
|
@@ -566,7 +559,7 @@
|
566
|
559
|
if (ubl.g26_debug_flag)
|
567
|
560
|
debug_current_and_destination((char*)"generic move done in ubl_line_to_destination()");
|
568
|
561
|
|
569
|
|
- if (current_position[0] != x_end || current_position[1] != y_end)
|
|
562
|
+ if (current_position[X_AXIS] != end[X_AXIS] || current_position[Y_AXIS] != end[Y_AXIS])
|
570
|
563
|
goto FINAL_MOVE;
|
571
|
564
|
|
572
|
565
|
set_current_to_destination();
|